| Index: content/browser/site_per_process_browsertest.cc
|
| diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
|
| index 19f96d6a93448a19c60bdc20d14236fde6258d66..e47429caa9b9306c7ca16f5b5b8e82bcaa6062fc 100644
|
| --- a/content/browser/site_per_process_browsertest.cc
|
| +++ b/content/browser/site_per_process_browsertest.cc
|
| @@ -5272,11 +5272,26 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| gfx::Point child_center(150, 150);
|
| auto* rwhv = static_cast<RenderWidgetHostViewAura*>(
|
| contents->GetRenderWidgetHostView());
|
| +
|
| + // Wait until renderer's compositor thread is synced.
|
| + RenderWidgetHost* child_render_widget_host =
|
| + root->child_at(0)->current_frame_host()->GetRenderWidgetHost();
|
| + {
|
| + auto observer =
|
| + base::MakeUnique<MainThreadFrameObserver>(child_render_widget_host);
|
| + observer->Wait();
|
| + }
|
| +
|
| ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0,
|
| ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f);
|
| rwhv->OnTouchEvent(&touch_event);
|
| + {
|
| + auto observer =
|
| + base::MakeUnique<MainThreadFrameObserver>(child_render_widget_host);
|
| + observer->Wait();
|
| + }
|
|
|
| - // Verify touch handler in subframe was invoked
|
| + // Verify touch handler in subframe was invoked.
|
| std::string result;
|
| EXPECT_TRUE(ExecuteScriptAndExtractString(
|
| root->child_at(0),
|
| @@ -5284,6 +5299,54 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| EXPECT_EQ("touchstart", result);
|
| }
|
|
|
| +// This test verifies that the test in
|
| +// SitePerProcessBrowserTest.SubframeTouchEventRouting also works properly for
|
| +// the main frame. Prior to the CL in which this test is introduced, use of
|
| +// MainThreadFrameObserver in SubframeTouchEventRouting was not necessary since
|
| +// the touch events were handled on the main thread. Now they are handled on the
|
| +// compositor thread, hence the need to synchronize.
|
| +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| + MainframeTouchEventRouting) {
|
| + GURL main_url(embedded_test_server()->GetURL(
|
| + "/page_with_touch_handler.html"));
|
| + EXPECT_TRUE(NavigateToURL(shell(), main_url));
|
| +
|
| + WebContentsImpl* contents = web_contents();
|
| + FrameTreeNode* root = contents->GetFrameTree()->root();
|
| +
|
| + // Synchronize with the renderers to guarantee that the
|
| + // surface information required for event hit testing is ready.
|
| + auto* rwhv = static_cast<RenderWidgetHostViewAura*>(
|
| + contents->GetRenderWidgetHostView());
|
| +
|
| + // Simulate touch event to sub-frame.
|
| + gfx::Point frame_center(150, 150);
|
| +
|
| + // Wait until renderer's compositor thread is synced.
|
| + RenderWidgetHost* render_widget_host = rwhv->GetRenderWidgetHost();
|
| + {
|
| + auto observer =
|
| + base::MakeUnique<MainThreadFrameObserver>(render_widget_host);
|
| + observer->Wait();
|
| + }
|
| +
|
| + ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, frame_center, 0, 0,
|
| + ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f);
|
| + rwhv->OnTouchEvent(&touch_event);
|
| + {
|
| + auto observer =
|
| + base::MakeUnique<MainThreadFrameObserver>(render_widget_host);
|
| + observer->Wait();
|
| + }
|
| +
|
| + // Verify touch handler in subframe was invoked.
|
| + std::string result;
|
| + EXPECT_TRUE(ExecuteScriptAndExtractString(
|
| + root, "window.domAutomationController.send(getLastTouchEvent());",
|
| + &result));
|
| + EXPECT_EQ("touchstart", result);
|
| +}
|
| +
|
| namespace {
|
|
|
| // Declared here to be close to the SubframeGestureEventRouting test.
|
|
|