| 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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 // Windows is disabled because of https://crbug.com/545547. | 751 // Windows is disabled because of https://crbug.com/545547. |
| 752 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest | 752 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 753 #else | 753 #else |
| 754 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest | 754 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest |
| 755 #endif | 755 #endif |
| 756 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 756 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
| 757 MAYBE_HighDPISurfaceHitTestTest) { | 757 MAYBE_HighDPISurfaceHitTestTest) { |
| 758 SurfaceHitTestTestHelper(shell(), embedded_test_server()); | 758 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 759 } | 759 } |
| 760 | 760 |
| 761 // This test tests that browser process hittesting ignores frames with | |
| 762 // pointer-events: none. | |
| 763 #if defined(OS_ANDROID) | |
| 764 // Browser process hit testing is not implemented on Android. | |
| 765 // https://crbug.com/491334 | |
| 766 #define MAYBE_SurfaceHitTestPointerEventsNone \ | |
| 767 DISABLED_SurfaceHitTestPointerEventsNone | |
| 768 #else | |
| 769 #define MAYBE_SurfaceHitTestPointerEventsNone SurfaceHitTestPointerEventsNone | |
| 770 #endif | |
| 771 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
| 772 MAYBE_SurfaceHitTestPointerEventsNone) { | |
| 773 GURL main_url(embedded_test_server()->GetURL( | |
| 774 "/frame_tree/page_with_positioned_frame_pointer-events_none.html")); | |
| 775 NavigateToURL(shell(), main_url); | |
| 776 | |
| 777 // It is safe to obtain the root frame tree node here, as it doesn't change. | |
| 778 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 779 ->GetFrameTree() | |
| 780 ->root(); | |
| 781 ASSERT_EQ(1U, root->child_count()); | |
| 782 | |
| 783 FrameTreeNode* child_node = root->child_at(0); | |
| 784 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | |
| 785 EXPECT_EQ(site_url, child_node->current_url()); | |
| 786 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | |
| 787 child_node->current_frame_host()->GetSiteInstance()); | |
| 788 | |
| 789 // Create listeners for mouse events. | |
| 790 RenderWidgetHostMouseEventMonitor main_frame_monitor( | |
| 791 root->current_frame_host()->GetRenderWidgetHost()); | |
| 792 RenderWidgetHostMouseEventMonitor child_frame_monitor( | |
| 793 child_node->current_frame_host()->GetRenderWidgetHost()); | |
| 794 | |
| 795 RenderWidgetHostInputEventRouter* router = | |
| 796 static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 797 ->GetInputEventRouter(); | |
| 798 | |
| 799 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | |
| 800 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 801 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | |
| 802 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 803 | |
| 804 // We need to wait for a compositor frame from the child frame, at which | |
| 805 // point its surface will be created. | |
| 806 while (rwhv_child->RendererFrameNumber() <= 0) { | |
| 807 // TODO(lazyboy): Find a better way to avoid sleeping like this. See | |
| 808 // http://crbug.com/405282 for details. | |
| 809 base::RunLoop run_loop; | |
| 810 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 811 FROM_HERE, run_loop.QuitClosure(), | |
| 812 base::TimeDelta::FromMilliseconds(10)); | |
| 813 run_loop.Run(); | |
| 814 } | |
| 815 | |
| 816 // Target input event to child frame. | |
| 817 blink::WebMouseEvent child_event; | |
| 818 child_event.type = blink::WebInputEvent::MouseDown; | |
| 819 child_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 820 child_event.x = 75; | |
| 821 child_event.y = 75; | |
| 822 child_event.clickCount = 1; | |
| 823 main_frame_monitor.ResetEventReceived(); | |
| 824 child_frame_monitor.ResetEventReceived(); | |
| 825 router->RouteMouseEvent(root_view, &child_event); | |
| 826 | |
| 827 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | |
| 828 EXPECT_EQ(75, main_frame_monitor.event().x); | |
| 829 EXPECT_EQ(75, main_frame_monitor.event().y); | |
| 830 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | |
| 831 } | |
| 832 | |
| 833 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 761 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
| 834 // OnSwapCompositorFrame message. | 762 // OnSwapCompositorFrame message. |
| 835 #if defined(OS_ANDROID) | 763 #if defined(OS_ANDROID) |
| 836 // http://crbug.com/471850 | 764 // http://crbug.com/471850 |
| 837 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped | 765 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped |
| 838 #else | 766 #else |
| 839 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped | 767 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped |
| 840 #endif | 768 #endif |
| 841 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 769 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 842 MAYBE_CompositorFrameSwapped) { | 770 MAYBE_CompositorFrameSwapped) { |
| (...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4459 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 4387 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 4460 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4388 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 4461 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 4389 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 4462 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4390 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 4463 | 4391 |
| 4464 // Ensure that the child process renderer is ready to have input events | 4392 // Ensure that the child process renderer is ready to have input events |
| 4465 // routed to it. This happens when the browser process has received | 4393 // routed to it. This happens when the browser process has received |
| 4466 // updated compositor surfaces from both renderer processes. | 4394 // updated compositor surfaces from both renderer processes. |
| 4467 gfx::Point point(75, 75); | 4395 gfx::Point point(75, 75); |
| 4468 gfx::Point transformed_point; | 4396 gfx::Point transformed_point; |
| 4469 while (root_view->SurfaceIdNamespaceAtPoint(nullptr, point, | 4397 while (root_view->SurfaceIdNamespaceAtPoint(point, &transformed_point) != |
| 4470 &transformed_point) != | |
| 4471 rwhv_child->GetSurfaceIdNamespace()) { | 4398 rwhv_child->GetSurfaceIdNamespace()) { |
| 4472 base::RunLoop run_loop; | 4399 base::RunLoop run_loop; |
| 4473 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 4400 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 4474 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); | 4401 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
| 4475 run_loop.Run(); | 4402 run_loop.Run(); |
| 4476 } | 4403 } |
| 4477 | 4404 |
| 4478 // A WebContentsDelegate to listen for the ShowContextMenu message. | 4405 // A WebContentsDelegate to listen for the ShowContextMenu message. |
| 4479 ContextMenuObserverDelegate context_menu_delegate; | 4406 ContextMenuObserverDelegate context_menu_delegate; |
| 4480 shell()->web_contents()->SetDelegate(&context_menu_delegate); | 4407 shell()->web_contents()->SetDelegate(&context_menu_delegate); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5051 // The popup's origin should match |b_url|, since it's not sandboxed. | 4978 // The popup's origin should match |b_url|, since it's not sandboxed. |
| 5052 std::string popup_origin; | 4979 std::string popup_origin; |
| 5053 EXPECT_TRUE(ExecuteScriptAndExtractString( | 4980 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 5054 foo_root->current_frame_host(), | 4981 foo_root->current_frame_host(), |
| 5055 "domAutomationController.send(document.origin)", | 4982 "domAutomationController.send(document.origin)", |
| 5056 &popup_origin)); | 4983 &popup_origin)); |
| 5057 EXPECT_EQ(b_url.GetOrigin().spec(), popup_origin + "/"); | 4984 EXPECT_EQ(b_url.GetOrigin().spec(), popup_origin + "/"); |
| 5058 } | 4985 } |
| 5059 | 4986 |
| 5060 } // namespace content | 4987 } // namespace content |
| OLD | NEW |