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