OLD | NEW |
---|---|
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 Loading... | |
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")); | |
lfg
2016/02/29 18:25:11
This is fine, but if you use cross_site_iframe_fac
kenrb
2016/02/29 19:59:54
It looks like it would be a similar amount of code
nasko
2016/02/29 22:15:37
Can't we define some positioning algorithm for the
kenrb
2016/03/01 15:50:30
I will take a todo on that, since I would need to
| |
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 child_frame_monitor( | |
nasko
2016/02/29 22:15:37
nit: nested_frame_monitor?
kenrb
2016/03/01 15:50:30
Done.
| |
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 child_event; | |
804 child_event.type = blink::WebInputEvent::MouseDown; | |
805 child_event.button = blink::WebPointerProperties::ButtonLeft; | |
806 child_event.x = 125; | |
807 child_event.y = 125; | |
808 child_event.clickCount = 1; | |
809 main_frame_monitor.ResetEventReceived(); | |
810 child_frame_monitor.ResetEventReceived(); | |
811 router->RouteMouseEvent(root_view, &child_event); | |
812 | |
813 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | |
814 EXPECT_EQ(21, child_frame_monitor.event().x); | |
815 EXPECT_EQ(21, child_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 Loading... | |
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 |
OLD | NEW |