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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // Windows is disabled because of https://crbug.com/545547. | 754 // Windows is disabled because of https://crbug.com/545547. |
755 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest | 755 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest |
756 #else | 756 #else |
757 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest | 757 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest |
758 #endif | 758 #endif |
759 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 759 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
760 MAYBE_HighDPISurfaceHitTestTest) { | 760 MAYBE_HighDPISurfaceHitTestTest) { |
761 SurfaceHitTestTestHelper(shell(), embedded_test_server()); | 761 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
762 } | 762 } |
763 | 763 |
| 764 // This test tests that browser process hittesting ignores frames with |
| 765 // pointer-events: none. |
| 766 #if defined(OS_ANDROID) |
| 767 // Browser process hit testing is not implemented on Android. |
| 768 // https://crbug.com/491334 |
| 769 #define MAYBE_SurfaceHitTestPointerEventsNone \ |
| 770 DISABLED_SurfaceHitTestPointerEventsNone |
| 771 #else |
| 772 #define MAYBE_SurfaceHitTestPointerEventsNone SurfaceHitTestPointerEventsNone |
| 773 #endif |
| 774 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 775 MAYBE_SurfaceHitTestPointerEventsNone) { |
| 776 if (!UseSurfacesEnabled()) |
| 777 return; |
| 778 |
| 779 GURL main_url(embedded_test_server()->GetURL( |
| 780 "/frame_tree/page_with_positioned_frame_pointer-events_none.html")); |
| 781 NavigateToURL(shell(), main_url); |
| 782 |
| 783 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 784 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 785 ->GetFrameTree() |
| 786 ->root(); |
| 787 ASSERT_EQ(1U, root->child_count()); |
| 788 |
| 789 FrameTreeNode* child_node = root->child_at(0); |
| 790 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| 791 EXPECT_EQ(site_url, child_node->current_url()); |
| 792 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 793 child_node->current_frame_host()->GetSiteInstance()); |
| 794 |
| 795 // Create listeners for mouse events. |
| 796 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 797 root->current_frame_host()->GetRenderWidgetHost()); |
| 798 RenderWidgetHostMouseEventMonitor child_frame_monitor( |
| 799 child_node->current_frame_host()->GetRenderWidgetHost()); |
| 800 |
| 801 RenderWidgetHostInputEventRouter* router = |
| 802 static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 803 ->GetInputEventRouter(); |
| 804 |
| 805 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 806 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 807 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 808 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 809 |
| 810 // We need to wait for a compositor frame from the child frame, at which |
| 811 // point its surface will be created. |
| 812 while (rwhv_child->RendererFrameNumber() <= 0) { |
| 813 // TODO(lazyboy): Find a better way to avoid sleeping like this. See |
| 814 // http://crbug.com/405282 for details. |
| 815 base::RunLoop run_loop; |
| 816 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 817 FROM_HERE, run_loop.QuitClosure(), |
| 818 base::TimeDelta::FromMilliseconds(10)); |
| 819 run_loop.Run(); |
| 820 } |
| 821 |
| 822 // Target input event to child frame. |
| 823 blink::WebMouseEvent child_event; |
| 824 child_event.type = blink::WebInputEvent::MouseDown; |
| 825 child_event.button = blink::WebPointerProperties::ButtonLeft; |
| 826 child_event.x = 75; |
| 827 child_event.y = 75; |
| 828 child_event.clickCount = 1; |
| 829 main_frame_monitor.ResetEventReceived(); |
| 830 child_frame_monitor.ResetEventReceived(); |
| 831 router->RouteMouseEvent(root_view, &child_event); |
| 832 |
| 833 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 834 EXPECT_EQ(75, main_frame_monitor.event().x); |
| 835 EXPECT_EQ(75, main_frame_monitor.event().y); |
| 836 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 837 } |
| 838 |
764 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 839 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
765 // OnSwapCompositorFrame message. | 840 // OnSwapCompositorFrame message. |
766 #if defined(OS_ANDROID) | 841 #if defined(OS_ANDROID) |
767 // http://crbug.com/471850 | 842 // http://crbug.com/471850 |
768 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped | 843 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped |
769 #else | 844 #else |
770 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped | 845 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped |
771 #endif | 846 #endif |
772 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 847 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
773 MAYBE_CompositorFrameSwapped) { | 848 MAYBE_CompositorFrameSwapped) { |
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4393 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 4468 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
4394 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4469 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
4395 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 4470 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
4396 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4471 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
4397 | 4472 |
4398 // Ensure that the child process renderer is ready to have input events | 4473 // Ensure that the child process renderer is ready to have input events |
4399 // routed to it. This happens when the browser process has received | 4474 // routed to it. This happens when the browser process has received |
4400 // updated compositor surfaces from both renderer processes. | 4475 // updated compositor surfaces from both renderer processes. |
4401 gfx::Point point(75, 75); | 4476 gfx::Point point(75, 75); |
4402 gfx::Point transformed_point; | 4477 gfx::Point transformed_point; |
4403 while (root_view->SurfaceIdNamespaceAtPoint(point, &transformed_point) != | 4478 while (root_view->SurfaceIdNamespaceAtPoint(nullptr, point, |
| 4479 &transformed_point) != |
4404 rwhv_child->GetSurfaceIdNamespace()) { | 4480 rwhv_child->GetSurfaceIdNamespace()) { |
4405 base::RunLoop run_loop; | 4481 base::RunLoop run_loop; |
4406 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 4482 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
4407 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 4483 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
4408 run_loop.Run(); | 4484 run_loop.Run(); |
4409 } | 4485 } |
4410 | 4486 |
4411 // A WebContentsDelegate to listen for the ShowContextMenu message. | 4487 // A WebContentsDelegate to listen for the ShowContextMenu message. |
4412 ContextMenuObserverDelegate context_menu_delegate; | 4488 ContextMenuObserverDelegate context_menu_delegate; |
4413 shell()->web_contents()->SetDelegate(&context_menu_delegate); | 4489 shell()->web_contents()->SetDelegate(&context_menu_delegate); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4851 EXPECT_EQ(blink::WebSandboxFlags::None, grandchild->pending_sandbox_flags()); | 4927 EXPECT_EQ(blink::WebSandboxFlags::None, grandchild->pending_sandbox_flags()); |
4852 EXPECT_EQ(blink::WebSandboxFlags::None, | 4928 EXPECT_EQ(blink::WebSandboxFlags::None, |
4853 grandchild->effective_sandbox_flags()); | 4929 grandchild->effective_sandbox_flags()); |
4854 | 4930 |
4855 // Check that the grandchild frame isn't sandboxed on the renderer side. If | 4931 // Check that the grandchild frame isn't sandboxed on the renderer side. If |
4856 // sandboxed, its origin would be unique ("null"). | 4932 // sandboxed, its origin would be unique ("null"). |
4857 EXPECT_EQ(frame_url.GetOrigin().spec(), GetDocumentOrigin(grandchild) + "/"); | 4933 EXPECT_EQ(frame_url.GetOrigin().spec(), GetDocumentOrigin(grandchild) + "/"); |
4858 } | 4934 } |
4859 | 4935 |
4860 } // namespace content | 4936 } // namespace content |
OLD | NEW |