Commit 87825703 authored by Yi Gu's avatar Yi Gu Committed by Commit Bot

[VizHitTesing] Fix flaky test...

[VizHitTesing] Fix flaky test SitePerProcessHitTestBrowserTest.SurfaceHitTestPointerEventsNoneChanged

The test was flaky due to a race condition which can be fixed by using
HitTestRegionObserver::WaitHitTestDataChange().

Test is updated with setTimeout in JavaScript to reliably reproduce the
flakiness.

Bug: 968970
Change-Id: I7a90429aa0d405165083147ae2f8eba41eb35fd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1703813Reviewed-by: default avatarJonathan Ross <jonross@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678385}
parent f10677e8
......@@ -2729,13 +2729,8 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessHitTestBrowserTest,
// This test tests that browser process hittesting ignores frames with
// pointer-events: none.
// TODO(https://crbug.com/968970): Flaky failures on all bots.
IN_PROC_BROWSER_TEST_P(SitePerProcessHitTestBrowserTest,
DISABLED_SurfaceHitTestPointerEventsNoneChanged) {
// In /2 hit testing, OOPIFs with pointer-events: none are ignored and no hit
// test data is submitted. To make sure we wait enough time until child frame
// fully loaded, we add a 1x1 pixel OOPIF for the test to track the process of
// /2 hit testing.
SurfaceHitTestPointerEventsNoneChanged) {
GURL main_url(embedded_test_server()->GetURL(
"/frame_tree/page_with_positioned_frame_pointer-events_none.html"));
EXPECT_TRUE(NavigateToURL(shell(), main_url));
......@@ -2786,35 +2781,26 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessHitTestBrowserTest,
kHitTestTolerance);
EXPECT_FALSE(child_frame_monitor.EventWasReceived());
// Remove pointer-events: none property from iframe, also remove child2 to
// properly notify the observer the update.
// Wait for the confirmation of the deletion so that surface hit test is aware
// of the change of pointer-events property. When viz hit testing is enabled,
// we do not need to wait.
EXPECT_TRUE(ExecuteScript(web_contents(),
"document.getElementsByTagName('iframe')[0].style."
"pointerEvents = 'auto';\n"));
HitTestRegionObserver hit_test_data_change_observer(
root_view->GetRootFrameSinkId());
hit_test_data_change_observer.WaitForHitTestData();
// Remove pointer-events: none property from iframe to check that it can claim
// the input event now.
EXPECT_TRUE(
ExecuteScript(web_contents(),
"setTimeout(function() {\n"
" document.getElementsByTagName('iframe')[0].style."
" pointerEvents = 'auto';\n"
"}, 100);"));
ASSERT_EQ(2U, root->child_count());
{
MainThreadFrameObserver observer(
root->current_frame_host()->GetRenderWidgetHost());
observer.Wait();
}
{
MainThreadFrameObserver observer(
root->child_at(0)->current_frame_host()->GetRenderWidgetHost());
observer.Wait();
}
{
MainThreadFrameObserver observer(
root->child_at(1)->current_frame_host()->GetRenderWidgetHost());
observer.Wait();
}
MainThreadFrameObserver observer(
root->current_frame_host()->GetRenderWidgetHost());
observer.Wait();
hit_test_data_change_observer.WaitForHitTestDataChange();
WaitForHitTestDataOrChildSurfaceReady(child_node1->current_frame_host());
WaitForHitTestDataOrChildSurfaceReady(child_node2->current_frame_host());
main_frame_monitor.ResetEventReceived();
child_frame_monitor.ResetEventReceived();
InputEventAckWaiter child_waiter(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment