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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 1743303002: Make browser hit testing return correct SurfaceId with nested Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits addressed Created 4 years, 10 months 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 | « cc/surfaces/surface_hittest.cc ('k') | content/test/content_browser_test_utils_internal.h » ('j') | no next file with comments »
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 c91e6b1592c5ed9150be7eb3b562882b55a28d60..24fb1e9248866b169861a12aafb4d0d33804925c 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -740,6 +740,82 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest,
SurfaceHitTestTestHelper(shell(), embedded_test_server());
}
+// Test that mouse events are being routed to the correct RenderWidgetHostView
+// when there are nested out-of-process iframes.
+#if defined(OS_ANDROID)
+// Browser process hit testing is not implemented on Android.
+// https://crbug.com/491334
+#define MAYBE_NestedSurfaceHitTestTest DISABLED_NestedSurfaceHitTestTest
+#else
+#define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest
+#endif
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+ MAYBE_NestedSurfaceHitTestTest) {
+ GURL main_url(embedded_test_server()->GetURL(
+ "/frame_tree/page_with_positioned_nested_frames.html"));
+ NavigateToURL(shell(), main_url);
+
+ // It is safe to obtain the root frame tree node here, as it doesn't change.
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()
+ ->root();
+ ASSERT_EQ(1U, root->child_count());
+
+ FrameTreeNode* parent_iframe_node = root->child_at(0);
+ GURL site_url(embedded_test_server()->GetURL(
+ "a.com", "/frame_tree/page_with_positioned_frame.html"));
+ EXPECT_EQ(site_url, parent_iframe_node->current_url());
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
+ parent_iframe_node->current_frame_host()->GetSiteInstance());
+
+ FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0);
+ GURL nested_site_url(
+ embedded_test_server()->GetURL("baz.com", "/title1.html"));
+ EXPECT_EQ(nested_site_url, nested_iframe_node->current_url());
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
+ nested_iframe_node->current_frame_host()->GetSiteInstance());
+ EXPECT_NE(parent_iframe_node->current_frame_host()->GetSiteInstance(),
+ nested_iframe_node->current_frame_host()->GetSiteInstance());
+
+ // Create listeners for mouse events.
+ RenderWidgetHostMouseEventMonitor main_frame_monitor(
+ root->current_frame_host()->GetRenderWidgetHost());
+ RenderWidgetHostMouseEventMonitor nested_frame_monitor(
+ nested_iframe_node->current_frame_host()->GetRenderWidgetHost());
+
+ RenderWidgetHostInputEventRouter* router =
+ static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetInputEventRouter();
+
+ RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
+ root->current_frame_host()->GetRenderWidgetHost()->GetView());
+ RenderWidgetHostViewBase* rwhv_nested =
+ static_cast<RenderWidgetHostViewBase*>(
+ nested_iframe_node->current_frame_host()
+ ->GetRenderWidgetHost()
+ ->GetView());
+
+ SurfaceHitTestReadyNotifier notifier(
+ static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
+ notifier.WaitForSurfaceReady();
+
+ // Target input event to nested frame.
+ blink::WebMouseEvent nested_event;
+ nested_event.type = blink::WebInputEvent::MouseDown;
+ nested_event.button = blink::WebPointerProperties::ButtonLeft;
+ nested_event.x = 125;
+ nested_event.y = 125;
+ nested_event.clickCount = 1;
+ nested_frame_monitor.ResetEventReceived();
+ main_frame_monitor.ResetEventReceived();
+ router->RouteMouseEvent(root_view, &nested_event);
+
+ EXPECT_TRUE(nested_frame_monitor.EventWasReceived());
+ EXPECT_EQ(21, nested_frame_monitor.event().x);
+ EXPECT_EQ(21, nested_frame_monitor.event().y);
+ EXPECT_FALSE(main_frame_monitor.EventWasReceived());
+}
+
// This test tests that browser process hittesting ignores frames with
// pointer-events: none.
#if defined(OS_ANDROID)
« no previous file with comments | « cc/surfaces/surface_hittest.cc ('k') | content/test/content_browser_test_utils_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698