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

Side by Side 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, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 // Windows is disabled because of https://crbug.com/545547. 733 // Windows is disabled because of https://crbug.com/545547.
734 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest 734 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest
735 #else 735 #else
736 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest 736 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest
737 #endif 737 #endif
738 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, 738 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest,
739 MAYBE_HighDPISurfaceHitTestTest) { 739 MAYBE_HighDPISurfaceHitTestTest) {
740 SurfaceHitTestTestHelper(shell(), embedded_test_server()); 740 SurfaceHitTestTestHelper(shell(), embedded_test_server());
741 } 741 }
742 742
743 // Test that mouse events are being routed to the correct RenderWidgetHostView
744 // when there are nested out-of-process iframes.
745 #if defined(OS_ANDROID)
746 // Browser process hit testing is not implemented on Android.
747 // https://crbug.com/491334
748 #define MAYBE_NestedSurfaceHitTestTest DISABLED_NestedSurfaceHitTestTest
749 #else
750 #define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest
751 #endif
752 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
753 MAYBE_NestedSurfaceHitTestTest) {
754 GURL main_url(embedded_test_server()->GetURL(
755 "/frame_tree/page_with_positioned_nested_frames.html"));
756 NavigateToURL(shell(), main_url);
757
758 // It is safe to obtain the root frame tree node here, as it doesn't change.
759 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
760 ->GetFrameTree()
761 ->root();
762 ASSERT_EQ(1U, root->child_count());
763
764 FrameTreeNode* parent_iframe_node = root->child_at(0);
765 GURL site_url(embedded_test_server()->GetURL(
766 "a.com", "/frame_tree/page_with_positioned_frame.html"));
767 EXPECT_EQ(site_url, parent_iframe_node->current_url());
768 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
769 parent_iframe_node->current_frame_host()->GetSiteInstance());
770
771 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0);
772 GURL nested_site_url(
773 embedded_test_server()->GetURL("baz.com", "/title1.html"));
774 EXPECT_EQ(nested_site_url, nested_iframe_node->current_url());
775 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
776 nested_iframe_node->current_frame_host()->GetSiteInstance());
777 EXPECT_NE(parent_iframe_node->current_frame_host()->GetSiteInstance(),
778 nested_iframe_node->current_frame_host()->GetSiteInstance());
779
780 // Create listeners for mouse events.
781 RenderWidgetHostMouseEventMonitor main_frame_monitor(
782 root->current_frame_host()->GetRenderWidgetHost());
783 RenderWidgetHostMouseEventMonitor nested_frame_monitor(
784 nested_iframe_node->current_frame_host()->GetRenderWidgetHost());
785
786 RenderWidgetHostInputEventRouter* router =
787 static_cast<WebContentsImpl*>(shell()->web_contents())
788 ->GetInputEventRouter();
789
790 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
791 root->current_frame_host()->GetRenderWidgetHost()->GetView());
792 RenderWidgetHostViewBase* rwhv_nested =
793 static_cast<RenderWidgetHostViewBase*>(
794 nested_iframe_node->current_frame_host()
795 ->GetRenderWidgetHost()
796 ->GetView());
797
798 SurfaceHitTestReadyNotifier notifier(
799 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
800 notifier.WaitForSurfaceReady();
801
802 // Target input event to nested frame.
803 blink::WebMouseEvent nested_event;
804 nested_event.type = blink::WebInputEvent::MouseDown;
805 nested_event.button = blink::WebPointerProperties::ButtonLeft;
806 nested_event.x = 125;
807 nested_event.y = 125;
808 nested_event.clickCount = 1;
809 nested_frame_monitor.ResetEventReceived();
810 main_frame_monitor.ResetEventReceived();
811 router->RouteMouseEvent(root_view, &nested_event);
812
813 EXPECT_TRUE(nested_frame_monitor.EventWasReceived());
814 EXPECT_EQ(21, nested_frame_monitor.event().x);
815 EXPECT_EQ(21, nested_frame_monitor.event().y);
816 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
817 }
818
743 // This test tests that browser process hittesting ignores frames with 819 // This test tests that browser process hittesting ignores frames with
744 // pointer-events: none. 820 // pointer-events: none.
745 #if defined(OS_ANDROID) 821 #if defined(OS_ANDROID)
746 // Browser process hit testing is not implemented on Android. 822 // Browser process hit testing is not implemented on Android.
747 // https://crbug.com/491334 823 // https://crbug.com/491334
748 #define MAYBE_SurfaceHitTestPointerEventsNone \ 824 #define MAYBE_SurfaceHitTestPointerEventsNone \
749 DISABLED_SurfaceHitTestPointerEventsNone 825 DISABLED_SurfaceHitTestPointerEventsNone
750 #elif defined(THREAD_SANITIZER) 826 #elif defined(THREAD_SANITIZER)
751 // Flaky on TSAN. https://crbug.com/582277 827 // Flaky on TSAN. https://crbug.com/582277
752 #define MAYBE_SurfaceHitTestPointerEventsNone \ 828 #define MAYBE_SurfaceHitTestPointerEventsNone \
(...skipping 4591 matching lines...) Expand 10 before | Expand all | Expand 10 after
5344 5420
5345 // Force the renderer to generate a new frame. 5421 // Force the renderer to generate a new frame.
5346 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), 5422 EXPECT_TRUE(ExecuteScript(shell()->web_contents(),
5347 "document.body.style.background = 'black'")); 5423 "document.body.style.background = 'black'"));
5348 5424
5349 // Waits for the next frame. 5425 // Waits for the next frame.
5350 observer->Wait(); 5426 observer->Wait();
5351 } 5427 }
5352 5428
5353 } // namespace content 5429 } // namespace content
OLDNEW
« 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