Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1746)

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: dcheng@'s suggestions, replumb enable_scroll_animator. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_dependencies.h » ('j') | content/renderer/render_view_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 55a2ab9ccfdf381c510fc51fe2d1ba762dbe1398..350a40ca0e00201d99ffb463a3a92f6082adce9f 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -5242,9 +5242,24 @@ 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
std::string result;
@@ -5254,6 +5269,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
Avi (use Gerrit) 2016/11/07 16:15:55 nit: period at end of sentence
wjmaclean 2016/11/07 17:43:17 Done.
+ 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.
« no previous file with comments | « no previous file | content/renderer/gpu/compositor_dependencies.h » ('j') | content/renderer/render_view_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698