| 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 13 matching lines...) Expand all Loading... |
| 24 #include "content/browser/frame_host/frame_tree.h" | 24 #include "content/browser/frame_host/frame_tree.h" |
| 25 #include "content/browser/frame_host/navigator.h" | 25 #include "content/browser/frame_host/navigator.h" |
| 26 #include "content/browser/frame_host/render_frame_proxy_host.h" | 26 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 27 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 27 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 28 #include "content/browser/gpu/compositor_util.h" | 28 #include "content/browser/gpu/compositor_util.h" |
| 29 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 29 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 30 #include "content/browser/renderer_host/input/synthetic_tap_gesture.h" | 30 #include "content/browser/renderer_host/input/synthetic_tap_gesture.h" |
| 31 #include "content/browser/renderer_host/render_view_host_impl.h" | 31 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 32 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 32 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
| 33 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 33 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 34 #include "content/browser/web_contents/web_contents_impl.h" | |
| 35 #include "content/common/frame_messages.h" | 34 #include "content/common/frame_messages.h" |
| 36 #include "content/common/input/synthetic_tap_gesture_params.h" | 35 #include "content/common/input/synthetic_tap_gesture_params.h" |
| 37 #include "content/common/view_messages.h" | 36 #include "content/common/view_messages.h" |
| 38 #include "content/public/browser/cert_store.h" | 37 #include "content/public/browser/cert_store.h" |
| 39 #include "content/public/browser/notification_observer.h" | 38 #include "content/public/browser/notification_observer.h" |
| 40 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/notification_types.h" | 40 #include "content/public/browser/notification_types.h" |
| 42 #include "content/public/browser/resource_dispatcher_host.h" | 41 #include "content/public/browser/resource_dispatcher_host.h" |
| 43 #include "content/public/common/browser_side_navigation_policy.h" | 42 #include "content/public/common/browser_side_navigation_policy.h" |
| 44 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 45 #include "content/public/common/url_constants.h" | 44 #include "content/public/common/url_constants.h" |
| 46 #include "content/public/test/browser_test_utils.h" | 45 #include "content/public/test/browser_test_utils.h" |
| 47 #include "content/public/test/content_browser_test_utils.h" | 46 #include "content/public/test/content_browser_test_utils.h" |
| 48 #include "content/public/test/test_navigation_observer.h" | 47 #include "content/public/test/test_navigation_observer.h" |
| 49 #include "content/public/test/test_utils.h" | 48 #include "content/public/test/test_utils.h" |
| 50 #include "content/shell/browser/shell.h" | |
| 51 #include "content/test/content_browser_test_utils_internal.h" | 49 #include "content/test/content_browser_test_utils_internal.h" |
| 52 #include "content/test/test_frame_navigation_observer.h" | 50 #include "content/test/test_frame_navigation_observer.h" |
| 53 #include "ipc/ipc_security_test_util.h" | 51 #include "ipc/ipc_security_test_util.h" |
| 54 #include "net/dns/mock_host_resolver.h" | 52 #include "net/dns/mock_host_resolver.h" |
| 55 #include "net/test/embedded_test_server/embedded_test_server.h" | 53 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 56 #include "third_party/WebKit/public/web/WebInputEvent.h" | 54 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 57 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 55 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 58 #include "ui/events/event.h" | 56 #include "ui/events/event.h" |
| 59 #include "ui/events/event_utils.h" | 57 #include "ui/events/event_utils.h" |
| 60 #include "ui/gfx/geometry/point.h" | 58 #include "ui/gfx/geometry/point.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 }; | 623 }; |
| 626 | 624 |
| 627 // Ensure that navigating subframes in --site-per-process mode works and the | 625 // Ensure that navigating subframes in --site-per-process mode works and the |
| 628 // correct documents are committed. | 626 // correct documents are committed. |
| 629 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { | 627 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
| 630 GURL main_url(embedded_test_server()->GetURL( | 628 GURL main_url(embedded_test_server()->GetURL( |
| 631 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 629 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 632 NavigateToURL(shell(), main_url); | 630 NavigateToURL(shell(), main_url); |
| 633 | 631 |
| 634 // It is safe to obtain the root frame tree node here, as it doesn't change. | 632 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 635 FrameTreeNode* root = | 633 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 636 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 637 GetFrameTree()->root(); | |
| 638 | 634 |
| 639 TestNavigationObserver observer(shell()->web_contents()); | 635 TestNavigationObserver observer(shell()->web_contents()); |
| 640 | 636 |
| 641 // Load same-site page into iframe. | 637 // Load same-site page into iframe. |
| 642 FrameTreeNode* child = root->child_at(0); | 638 FrameTreeNode* child = root->child_at(0); |
| 643 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 639 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 644 NavigateFrameToURL(child, http_url); | 640 NavigateFrameToURL(child, http_url); |
| 645 EXPECT_EQ(http_url, observer.last_navigation_url()); | 641 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 646 EXPECT_TRUE(observer.last_navigation_succeeded()); | 642 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 647 { | 643 { |
| 648 // There should be only one RenderWidgetHost when there are no | 644 // There should be only one RenderWidgetHost when there are no |
| 649 // cross-process iframes. | 645 // cross-process iframes. |
| 650 std::set<RenderWidgetHostView*> views_set = | 646 std::set<RenderWidgetHostView*> views_set = |
| 651 static_cast<WebContentsImpl*>(shell()->web_contents()) | 647 web_contents()->GetRenderWidgetHostViewsInTree(); |
| 652 ->GetRenderWidgetHostViewsInTree(); | |
| 653 EXPECT_EQ(1U, views_set.size()); | 648 EXPECT_EQ(1U, views_set.size()); |
| 654 } | 649 } |
| 655 | 650 |
| 656 EXPECT_EQ( | 651 EXPECT_EQ( |
| 657 " Site A\n" | 652 " Site A\n" |
| 658 " |--Site A\n" | 653 " |--Site A\n" |
| 659 " +--Site A\n" | 654 " +--Site A\n" |
| 660 " |--Site A\n" | 655 " |--Site A\n" |
| 661 " +--Site A\n" | 656 " +--Site A\n" |
| 662 " +--Site A\n" | 657 " +--Site A\n" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 675 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); | 670 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
| 676 RenderViewHost* rvh = child->current_frame_host()->render_view_host(); | 671 RenderViewHost* rvh = child->current_frame_host()->render_view_host(); |
| 677 RenderProcessHost* rph = child->current_frame_host()->GetProcess(); | 672 RenderProcessHost* rph = child->current_frame_host()->GetProcess(); |
| 678 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh); | 673 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh); |
| 679 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | 674 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
| 680 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph); | 675 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph); |
| 681 { | 676 { |
| 682 // There should be now two RenderWidgetHosts, one for each process | 677 // There should be now two RenderWidgetHosts, one for each process |
| 683 // rendering a frame. | 678 // rendering a frame. |
| 684 std::set<RenderWidgetHostView*> views_set = | 679 std::set<RenderWidgetHostView*> views_set = |
| 685 static_cast<WebContentsImpl*>(shell()->web_contents()) | 680 web_contents()->GetRenderWidgetHostViewsInTree(); |
| 686 ->GetRenderWidgetHostViewsInTree(); | |
| 687 EXPECT_EQ(2U, views_set.size()); | 681 EXPECT_EQ(2U, views_set.size()); |
| 688 } | 682 } |
| 689 RenderFrameProxyHost* proxy_to_parent = | 683 RenderFrameProxyHost* proxy_to_parent = |
| 690 child->render_manager()->GetProxyToParent(); | 684 child->render_manager()->GetProxyToParent(); |
| 691 EXPECT_TRUE(proxy_to_parent); | 685 EXPECT_TRUE(proxy_to_parent); |
| 692 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 686 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
| 693 // The out-of-process iframe should have its own RenderWidgetHost, | 687 // The out-of-process iframe should have its own RenderWidgetHost, |
| 694 // independent of any RenderViewHost. | 688 // independent of any RenderViewHost. |
| 695 EXPECT_NE( | 689 EXPECT_NE( |
| 696 rvh->GetWidget()->GetView(), | 690 rvh->GetWidget()->GetView(), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 723 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); | 717 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); |
| 724 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 718 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 725 child->current_frame_host()->GetSiteInstance()); | 719 child->current_frame_host()->GetSiteInstance()); |
| 726 EXPECT_NE(site_instance, | 720 EXPECT_NE(site_instance, |
| 727 child->current_frame_host()->GetSiteInstance()); | 721 child->current_frame_host()->GetSiteInstance()); |
| 728 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), | 722 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), |
| 729 child->current_frame_host()->GetProcess()); | 723 child->current_frame_host()->GetProcess()); |
| 730 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); | 724 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); |
| 731 { | 725 { |
| 732 std::set<RenderWidgetHostView*> views_set = | 726 std::set<RenderWidgetHostView*> views_set = |
| 733 static_cast<WebContentsImpl*>(shell()->web_contents()) | 727 web_contents()->GetRenderWidgetHostViewsInTree(); |
| 734 ->GetRenderWidgetHostViewsInTree(); | |
| 735 EXPECT_EQ(2U, views_set.size()); | 728 EXPECT_EQ(2U, views_set.size()); |
| 736 } | 729 } |
| 737 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); | 730 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); |
| 738 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 731 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
| 739 EXPECT_NE( | 732 EXPECT_NE( |
| 740 child->current_frame_host()->render_view_host()->GetWidget()->GetView(), | 733 child->current_frame_host()->render_view_host()->GetWidget()->GetView(), |
| 741 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 734 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
| 742 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); | 735 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
| 743 | 736 |
| 744 EXPECT_EQ( | 737 EXPECT_EQ( |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 #else | 908 #else |
| 916 #define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest | 909 #define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest |
| 917 #endif | 910 #endif |
| 918 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 911 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 919 MAYBE_NestedSurfaceHitTestTest) { | 912 MAYBE_NestedSurfaceHitTestTest) { |
| 920 GURL main_url(embedded_test_server()->GetURL( | 913 GURL main_url(embedded_test_server()->GetURL( |
| 921 "/frame_tree/page_with_positioned_nested_frames.html")); | 914 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 922 NavigateToURL(shell(), main_url); | 915 NavigateToURL(shell(), main_url); |
| 923 | 916 |
| 924 // It is safe to obtain the root frame tree node here, as it doesn't change. | 917 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 925 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 918 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 926 ->GetFrameTree() | |
| 927 ->root(); | |
| 928 ASSERT_EQ(1U, root->child_count()); | 919 ASSERT_EQ(1U, root->child_count()); |
| 929 | 920 |
| 930 FrameTreeNode* parent_iframe_node = root->child_at(0); | 921 FrameTreeNode* parent_iframe_node = root->child_at(0); |
| 931 GURL site_url(embedded_test_server()->GetURL( | 922 GURL site_url(embedded_test_server()->GetURL( |
| 932 "a.com", "/frame_tree/page_with_positioned_frame.html")); | 923 "a.com", "/frame_tree/page_with_positioned_frame.html")); |
| 933 EXPECT_EQ(site_url, parent_iframe_node->current_url()); | 924 EXPECT_EQ(site_url, parent_iframe_node->current_url()); |
| 934 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 925 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 935 parent_iframe_node->current_frame_host()->GetSiteInstance()); | 926 parent_iframe_node->current_frame_host()->GetSiteInstance()); |
| 936 | 927 |
| 937 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0); | 928 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0); |
| 938 GURL nested_site_url( | 929 GURL nested_site_url( |
| 939 embedded_test_server()->GetURL("baz.com", "/title1.html")); | 930 embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| 940 EXPECT_EQ(nested_site_url, nested_iframe_node->current_url()); | 931 EXPECT_EQ(nested_site_url, nested_iframe_node->current_url()); |
| 941 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 932 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 942 nested_iframe_node->current_frame_host()->GetSiteInstance()); | 933 nested_iframe_node->current_frame_host()->GetSiteInstance()); |
| 943 EXPECT_NE(parent_iframe_node->current_frame_host()->GetSiteInstance(), | 934 EXPECT_NE(parent_iframe_node->current_frame_host()->GetSiteInstance(), |
| 944 nested_iframe_node->current_frame_host()->GetSiteInstance()); | 935 nested_iframe_node->current_frame_host()->GetSiteInstance()); |
| 945 | 936 |
| 946 // Create listeners for mouse events. | 937 // Create listeners for mouse events. |
| 947 RenderWidgetHostMouseEventMonitor main_frame_monitor( | 938 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 948 root->current_frame_host()->GetRenderWidgetHost()); | 939 root->current_frame_host()->GetRenderWidgetHost()); |
| 949 RenderWidgetHostMouseEventMonitor nested_frame_monitor( | 940 RenderWidgetHostMouseEventMonitor nested_frame_monitor( |
| 950 nested_iframe_node->current_frame_host()->GetRenderWidgetHost()); | 941 nested_iframe_node->current_frame_host()->GetRenderWidgetHost()); |
| 951 | 942 |
| 952 RenderWidgetHostInputEventRouter* router = | 943 RenderWidgetHostInputEventRouter* router = |
| 953 static_cast<WebContentsImpl*>(shell()->web_contents()) | 944 web_contents()->GetInputEventRouter(); |
| 954 ->GetInputEventRouter(); | |
| 955 | 945 |
| 956 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 946 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 957 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 947 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 958 RenderWidgetHostViewBase* rwhv_nested = | 948 RenderWidgetHostViewBase* rwhv_nested = |
| 959 static_cast<RenderWidgetHostViewBase*>( | 949 static_cast<RenderWidgetHostViewBase*>( |
| 960 nested_iframe_node->current_frame_host() | 950 nested_iframe_node->current_frame_host() |
| 961 ->GetRenderWidgetHost() | 951 ->GetRenderWidgetHost() |
| 962 ->GetView()); | 952 ->GetView()); |
| 963 | 953 |
| 964 SurfaceHitTestReadyNotifier notifier( | 954 SurfaceHitTestReadyNotifier notifier( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 #else | 986 #else |
| 997 #define MAYBE_SurfaceHitTestPointerEventsNone SurfaceHitTestPointerEventsNone | 987 #define MAYBE_SurfaceHitTestPointerEventsNone SurfaceHitTestPointerEventsNone |
| 998 #endif | 988 #endif |
| 999 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 989 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1000 MAYBE_SurfaceHitTestPointerEventsNone) { | 990 MAYBE_SurfaceHitTestPointerEventsNone) { |
| 1001 GURL main_url(embedded_test_server()->GetURL( | 991 GURL main_url(embedded_test_server()->GetURL( |
| 1002 "/frame_tree/page_with_positioned_frame_pointer-events_none.html")); | 992 "/frame_tree/page_with_positioned_frame_pointer-events_none.html")); |
| 1003 NavigateToURL(shell(), main_url); | 993 NavigateToURL(shell(), main_url); |
| 1004 | 994 |
| 1005 // It is safe to obtain the root frame tree node here, as it doesn't change. | 995 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1006 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 996 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1007 ->GetFrameTree() | |
| 1008 ->root(); | |
| 1009 ASSERT_EQ(1U, root->child_count()); | 997 ASSERT_EQ(1U, root->child_count()); |
| 1010 | 998 |
| 1011 FrameTreeNode* child_node = root->child_at(0); | 999 FrameTreeNode* child_node = root->child_at(0); |
| 1012 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 1000 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| 1013 EXPECT_EQ(site_url, child_node->current_url()); | 1001 EXPECT_EQ(site_url, child_node->current_url()); |
| 1014 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 1002 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 1015 child_node->current_frame_host()->GetSiteInstance()); | 1003 child_node->current_frame_host()->GetSiteInstance()); |
| 1016 | 1004 |
| 1017 // Create listeners for mouse events. | 1005 // Create listeners for mouse events. |
| 1018 RenderWidgetHostMouseEventMonitor main_frame_monitor( | 1006 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 1019 root->current_frame_host()->GetRenderWidgetHost()); | 1007 root->current_frame_host()->GetRenderWidgetHost()); |
| 1020 RenderWidgetHostMouseEventMonitor child_frame_monitor( | 1008 RenderWidgetHostMouseEventMonitor child_frame_monitor( |
| 1021 child_node->current_frame_host()->GetRenderWidgetHost()); | 1009 child_node->current_frame_host()->GetRenderWidgetHost()); |
| 1022 | 1010 |
| 1023 RenderWidgetHostInputEventRouter* router = | 1011 RenderWidgetHostInputEventRouter* router = |
| 1024 static_cast<WebContentsImpl*>(shell()->web_contents()) | 1012 web_contents()->GetInputEventRouter(); |
| 1025 ->GetInputEventRouter(); | |
| 1026 | 1013 |
| 1027 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 1014 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 1028 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1015 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 1029 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 1016 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 1030 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1017 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 1031 | 1018 |
| 1032 SurfaceHitTestReadyNotifier notifier( | 1019 SurfaceHitTestReadyNotifier notifier( |
| 1033 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 1020 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
| 1034 notifier.WaitForSurfaceReady(); | 1021 notifier.WaitForSurfaceReady(); |
| 1035 | 1022 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1058 #else | 1045 #else |
| 1059 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped | 1046 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped |
| 1060 #endif | 1047 #endif |
| 1061 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1048 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1062 MAYBE_CompositorFrameSwapped) { | 1049 MAYBE_CompositorFrameSwapped) { |
| 1063 GURL main_url(embedded_test_server()->GetURL( | 1050 GURL main_url(embedded_test_server()->GetURL( |
| 1064 "a.com", "/cross_site_iframe_factory.html?a(baz)")); | 1051 "a.com", "/cross_site_iframe_factory.html?a(baz)")); |
| 1065 NavigateToURL(shell(), main_url); | 1052 NavigateToURL(shell(), main_url); |
| 1066 | 1053 |
| 1067 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1054 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1068 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1055 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1069 ->GetFrameTree() | |
| 1070 ->root(); | |
| 1071 ASSERT_EQ(1U, root->child_count()); | 1056 ASSERT_EQ(1U, root->child_count()); |
| 1072 | 1057 |
| 1073 FrameTreeNode* child_node = root->child_at(0); | 1058 FrameTreeNode* child_node = root->child_at(0); |
| 1074 GURL site_url(embedded_test_server()->GetURL( | 1059 GURL site_url(embedded_test_server()->GetURL( |
| 1075 "baz.com", "/cross_site_iframe_factory.html?baz()")); | 1060 "baz.com", "/cross_site_iframe_factory.html?baz()")); |
| 1076 EXPECT_EQ(site_url, child_node->current_url()); | 1061 EXPECT_EQ(site_url, child_node->current_url()); |
| 1077 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 1062 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 1078 child_node->current_frame_host()->GetSiteInstance()); | 1063 child_node->current_frame_host()->GetSiteInstance()); |
| 1079 RenderWidgetHostViewBase* rwhv_base = static_cast<RenderWidgetHostViewBase*>( | 1064 RenderWidgetHostViewBase* rwhv_base = static_cast<RenderWidgetHostViewBase*>( |
| 1080 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 1065 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1091 } | 1076 } |
| 1092 } | 1077 } |
| 1093 | 1078 |
| 1094 // Ensure that OOPIFs are deleted after navigating to a new main frame. | 1079 // Ensure that OOPIFs are deleted after navigating to a new main frame. |
| 1095 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { | 1080 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { |
| 1096 GURL main_url(embedded_test_server()->GetURL( | 1081 GURL main_url(embedded_test_server()->GetURL( |
| 1097 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 1082 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 1098 NavigateToURL(shell(), main_url); | 1083 NavigateToURL(shell(), main_url); |
| 1099 | 1084 |
| 1100 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1085 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1101 FrameTreeNode* root = | 1086 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1102 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1103 GetFrameTree()->root(); | |
| 1104 | 1087 |
| 1105 TestNavigationObserver observer(shell()->web_contents()); | 1088 TestNavigationObserver observer(shell()->web_contents()); |
| 1106 | 1089 |
| 1107 // Load a cross-site page into both iframes. | 1090 // Load a cross-site page into both iframes. |
| 1108 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 1091 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 1109 NavigateFrameToURL(root->child_at(0), foo_url); | 1092 NavigateFrameToURL(root->child_at(0), foo_url); |
| 1110 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1093 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1111 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 1094 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 1112 NavigateFrameToURL(root->child_at(1), foo_url); | 1095 NavigateFrameToURL(root->child_at(1), foo_url); |
| 1113 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1096 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 EXPECT_FALSE(RenderViewHost::FromID(subframe_process_id, subframe_rvh_id)); | 1133 EXPECT_FALSE(RenderViewHost::FromID(subframe_process_id, subframe_rvh_id)); |
| 1151 } | 1134 } |
| 1152 | 1135 |
| 1153 // Ensure that root frames cannot be detached. | 1136 // Ensure that root frames cannot be detached. |
| 1154 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RestrictFrameDetach) { | 1137 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RestrictFrameDetach) { |
| 1155 GURL main_url(embedded_test_server()->GetURL( | 1138 GURL main_url(embedded_test_server()->GetURL( |
| 1156 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 1139 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 1157 NavigateToURL(shell(), main_url); | 1140 NavigateToURL(shell(), main_url); |
| 1158 | 1141 |
| 1159 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1142 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1160 FrameTreeNode* root = | 1143 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1161 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1162 GetFrameTree()->root(); | |
| 1163 | 1144 |
| 1164 TestNavigationObserver observer(shell()->web_contents()); | 1145 TestNavigationObserver observer(shell()->web_contents()); |
| 1165 | 1146 |
| 1166 // Load cross-site pages into both iframes. | 1147 // Load cross-site pages into both iframes. |
| 1167 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 1148 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 1168 NavigateFrameToURL(root->child_at(0), foo_url); | 1149 NavigateFrameToURL(root->child_at(0), foo_url); |
| 1169 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1150 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1170 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 1151 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 1171 GURL bar_url = embedded_test_server()->GetURL("bar.com", "/title2.html"); | 1152 GURL bar_url = embedded_test_server()->GetURL("bar.com", "/title2.html"); |
| 1172 NavigateFrameToURL(root->child_at(1), bar_url); | 1153 NavigateFrameToURL(root->child_at(1), bar_url); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 " C = http://bar.com/", | 1195 " C = http://bar.com/", |
| 1215 DepictFrameTree(root)); | 1196 DepictFrameTree(root)); |
| 1216 } | 1197 } |
| 1217 | 1198 |
| 1218 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) { | 1199 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) { |
| 1219 GURL main_url(embedded_test_server()->GetURL( | 1200 GURL main_url(embedded_test_server()->GetURL( |
| 1220 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 1201 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 1221 NavigateToURL(shell(), main_url); | 1202 NavigateToURL(shell(), main_url); |
| 1222 | 1203 |
| 1223 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1204 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1224 FrameTreeNode* root = | 1205 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1225 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1226 GetFrameTree()->root(); | |
| 1227 | 1206 |
| 1228 TestNavigationObserver observer(shell()->web_contents()); | 1207 TestNavigationObserver observer(shell()->web_contents()); |
| 1229 | 1208 |
| 1230 // Load same-site page into iframe. | 1209 // Load same-site page into iframe. |
| 1231 FrameTreeNode* child = root->child_at(0); | 1210 FrameTreeNode* child = root->child_at(0); |
| 1232 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1211 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1233 NavigateFrameToURL(child, http_url); | 1212 NavigateFrameToURL(child, http_url); |
| 1234 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1213 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1235 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1214 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1236 | 1215 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 child->current_frame_host()->GetSiteInstance()); | 1262 child->current_frame_host()->GetSiteInstance()); |
| 1284 } | 1263 } |
| 1285 | 1264 |
| 1286 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1265 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1287 NavigateRemoteFrameToBlankAndDataURLs) { | 1266 NavigateRemoteFrameToBlankAndDataURLs) { |
| 1288 GURL main_url(embedded_test_server()->GetURL( | 1267 GURL main_url(embedded_test_server()->GetURL( |
| 1289 "a.com", "/cross_site_iframe_factory.html?a(a,a(a))")); | 1268 "a.com", "/cross_site_iframe_factory.html?a(a,a(a))")); |
| 1290 NavigateToURL(shell(), main_url); | 1269 NavigateToURL(shell(), main_url); |
| 1291 | 1270 |
| 1292 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1271 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1293 FrameTreeNode* root = | 1272 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1294 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1295 GetFrameTree()->root(); | |
| 1296 | 1273 |
| 1297 TestNavigationObserver observer(shell()->web_contents()); | 1274 TestNavigationObserver observer(shell()->web_contents()); |
| 1298 | 1275 |
| 1299 // Load same-site page into iframe. | 1276 // Load same-site page into iframe. |
| 1300 FrameTreeNode* child = root->child_at(0); | 1277 FrameTreeNode* child = root->child_at(0); |
| 1301 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1278 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1302 NavigateFrameToURL(child, http_url); | 1279 NavigateFrameToURL(child, http_url); |
| 1303 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1280 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1304 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1281 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1305 EXPECT_EQ( | 1282 EXPECT_EQ( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 // | 1368 // |
| 1392 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to | 1369 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to |
| 1393 // site B and stays in not rendered state. | 1370 // site B and stays in not rendered state. |
| 1394 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1371 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1395 NavigateRemoteFrameToKilledProcess) { | 1372 NavigateRemoteFrameToKilledProcess) { |
| 1396 GURL main_url(embedded_test_server()->GetURL( | 1373 GURL main_url(embedded_test_server()->GetURL( |
| 1397 "foo.com", "/cross_site_iframe_factory.html?foo.com(bar.com, foo.com)")); | 1374 "foo.com", "/cross_site_iframe_factory.html?foo.com(bar.com, foo.com)")); |
| 1398 NavigateToURL(shell(), main_url); | 1375 NavigateToURL(shell(), main_url); |
| 1399 | 1376 |
| 1400 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1377 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1401 FrameTreeNode* root = | 1378 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1402 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1403 GetFrameTree()->root(); | |
| 1404 | 1379 |
| 1405 TestNavigationObserver observer(shell()->web_contents()); | 1380 TestNavigationObserver observer(shell()->web_contents()); |
| 1406 ASSERT_EQ(2U, root->child_count()); | 1381 ASSERT_EQ(2U, root->child_count()); |
| 1407 | 1382 |
| 1408 // Make sure node2 points to the correct cross-site page. | 1383 // Make sure node2 points to the correct cross-site page. |
| 1409 GURL site_b_url = embedded_test_server()->GetURL( | 1384 GURL site_b_url = embedded_test_server()->GetURL( |
| 1410 "bar.com", "/cross_site_iframe_factory.html?bar.com()"); | 1385 "bar.com", "/cross_site_iframe_factory.html?bar.com()"); |
| 1411 FrameTreeNode* node2 = root->child_at(0); | 1386 FrameTreeNode* node2 = root->child_at(0); |
| 1412 EXPECT_EQ(site_b_url, node2->current_url()); | 1387 EXPECT_EQ(site_b_url, node2->current_url()); |
| 1413 | 1388 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1442 // | 1417 // |
| 1443 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to | 1418 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to |
| 1444 // site B and stays in not rendered state. | 1419 // site B and stays in not rendered state. |
| 1445 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1420 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1446 NavigateRemoteFrameToKilledProcessWithSubtree) { | 1421 NavigateRemoteFrameToKilledProcessWithSubtree) { |
| 1447 GURL main_url(embedded_test_server()->GetURL( | 1422 GURL main_url(embedded_test_server()->GetURL( |
| 1448 "a.com", "/cross_site_iframe_factory.html?a(bar(baz), a)")); | 1423 "a.com", "/cross_site_iframe_factory.html?a(bar(baz), a)")); |
| 1449 NavigateToURL(shell(), main_url); | 1424 NavigateToURL(shell(), main_url); |
| 1450 | 1425 |
| 1451 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1426 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1452 FrameTreeNode* root = | 1427 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1453 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1454 GetFrameTree()->root(); | |
| 1455 TestNavigationObserver observer(shell()->web_contents()); | 1428 TestNavigationObserver observer(shell()->web_contents()); |
| 1456 | 1429 |
| 1457 ASSERT_EQ(2U, root->child_count()); | 1430 ASSERT_EQ(2U, root->child_count()); |
| 1458 | 1431 |
| 1459 GURL site_b_url(embedded_test_server()->GetURL( | 1432 GURL site_b_url(embedded_test_server()->GetURL( |
| 1460 "bar.com", "/cross_site_iframe_factory.html?bar(baz())")); | 1433 "bar.com", "/cross_site_iframe_factory.html?bar(baz())")); |
| 1461 // We can't use a TestNavigationObserver to verify the URL here, | 1434 // We can't use a TestNavigationObserver to verify the URL here, |
| 1462 // since the frame has children that may have clobbered it in the observer. | 1435 // since the frame has children that may have clobbered it in the observer. |
| 1463 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); | 1436 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); |
| 1464 | 1437 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 | 1502 |
| 1530 // Ensure that the renderer process doesn't crash when the main frame navigates | 1503 // Ensure that the renderer process doesn't crash when the main frame navigates |
| 1531 // a remote child to a page that results in a network error. | 1504 // a remote child to a page that results in a network error. |
| 1532 // See https://crbug.com/558016. | 1505 // See https://crbug.com/558016. |
| 1533 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { | 1506 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { |
| 1534 GURL main_url(embedded_test_server()->GetURL( | 1507 GURL main_url(embedded_test_server()->GetURL( |
| 1535 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 1508 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1536 NavigateToURL(shell(), main_url); | 1509 NavigateToURL(shell(), main_url); |
| 1537 | 1510 |
| 1538 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1511 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1539 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1512 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1540 ->GetFrameTree() | |
| 1541 ->root(); | |
| 1542 | 1513 |
| 1543 // Load same-site page into iframe. | 1514 // Load same-site page into iframe. |
| 1544 { | 1515 { |
| 1545 TestNavigationObserver observer(shell()->web_contents()); | 1516 TestNavigationObserver observer(shell()->web_contents()); |
| 1546 FrameTreeNode* child = root->child_at(0); | 1517 FrameTreeNode* child = root->child_at(0); |
| 1547 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1518 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1548 NavigateFrameToURL(child, http_url); | 1519 NavigateFrameToURL(child, http_url); |
| 1549 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1520 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1550 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1521 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1551 observer.Wait(); | 1522 observer.Wait(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 // successfully loads after earlier encountering a network error for it. | 1556 // successfully loads after earlier encountering a network error for it. |
| 1586 // See https://crbug.com/560511. | 1557 // See https://crbug.com/560511. |
| 1587 // TODO(creis): Make the net error page show in the correct process as well, | 1558 // TODO(creis): Make the net error page show in the correct process as well, |
| 1588 // per https://crbug.com/588314. | 1559 // per https://crbug.com/588314. |
| 1589 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ProcessTransferAfterError) { | 1560 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ProcessTransferAfterError) { |
| 1590 GURL main_url(embedded_test_server()->GetURL( | 1561 GURL main_url(embedded_test_server()->GetURL( |
| 1591 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 1562 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1592 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1563 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1593 | 1564 |
| 1594 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1565 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1595 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1566 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1596 ->GetFrameTree() | |
| 1597 ->root(); | |
| 1598 FrameTreeNode* child = root->child_at(0); | 1567 FrameTreeNode* child = root->child_at(0); |
| 1599 GURL url_a = child->current_url(); | 1568 GURL url_a = child->current_url(); |
| 1600 | 1569 |
| 1601 // Disable host resolution in the test server and try to navigate the subframe | 1570 // Disable host resolution in the test server and try to navigate the subframe |
| 1602 // cross-site, which will lead to a committed net error (which looks like | 1571 // cross-site, which will lead to a committed net error (which looks like |
| 1603 // success to the TestNavigationObserver). | 1572 // success to the TestNavigationObserver). |
| 1604 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); | 1573 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); |
| 1605 host_resolver()->ClearRules(); | 1574 host_resolver()->ClearRules(); |
| 1606 TestNavigationObserver observer(shell()->web_contents()); | 1575 TestNavigationObserver observer(shell()->web_contents()); |
| 1607 NavigateIframeToURL(shell()->web_contents(), "child-0", url_b); | 1576 NavigateIframeToURL(shell()->web_contents(), "child-0", url_b); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 // verifying that a proxy for node 4 has been recreated in process B. This | 1658 // verifying that a proxy for node 4 has been recreated in process B. This |
| 1690 // verifies the fix for https://crbug.com/478892. | 1659 // verifies the fix for https://crbug.com/478892. |
| 1691 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1660 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1692 NavigatingToKilledProcessRestoresAllProxies) { | 1661 NavigatingToKilledProcessRestoresAllProxies) { |
| 1693 // Navigate to a page with three frames: one cross-site and two same-site. | 1662 // Navigate to a page with three frames: one cross-site and two same-site. |
| 1694 GURL main_url(embedded_test_server()->GetURL( | 1663 GURL main_url(embedded_test_server()->GetURL( |
| 1695 "a.com", "/frame_tree/page_with_three_frames.html")); | 1664 "a.com", "/frame_tree/page_with_three_frames.html")); |
| 1696 NavigateToURL(shell(), main_url); | 1665 NavigateToURL(shell(), main_url); |
| 1697 | 1666 |
| 1698 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1667 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1699 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1668 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1700 ->GetFrameTree() | |
| 1701 ->root(); | |
| 1702 TestNavigationObserver observer(shell()->web_contents()); | 1669 TestNavigationObserver observer(shell()->web_contents()); |
| 1703 | 1670 |
| 1704 EXPECT_EQ( | 1671 EXPECT_EQ( |
| 1705 " Site A ------------ proxies for B\n" | 1672 " Site A ------------ proxies for B\n" |
| 1706 " |--Site B ------- proxies for A\n" | 1673 " |--Site B ------- proxies for A\n" |
| 1707 " |--Site A ------- proxies for B\n" | 1674 " |--Site A ------- proxies for B\n" |
| 1708 " +--Site A ------- proxies for B\n" | 1675 " +--Site A ------- proxies for B\n" |
| 1709 "Where A = http://a.com/\n" | 1676 "Where A = http://a.com/\n" |
| 1710 " B = http://b.com/", | 1677 " B = http://b.com/", |
| 1711 DepictFrameTree(root)); | 1678 DepictFrameTree(root)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 // process A, and then checks that process B isn't resurrected to create a | 1721 // process A, and then checks that process B isn't resurrected to create a |
| 1755 // proxy for the new child frame. See https://crbug.com/476846. | 1722 // proxy for the new child frame. See https://crbug.com/476846. |
| 1756 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1723 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1757 CreateChildFrameAfterKillingProcess) { | 1724 CreateChildFrameAfterKillingProcess) { |
| 1758 // Navigate to a page with three frames: one cross-site and two same-site. | 1725 // Navigate to a page with three frames: one cross-site and two same-site. |
| 1759 GURL main_url(embedded_test_server()->GetURL( | 1726 GURL main_url(embedded_test_server()->GetURL( |
| 1760 "a.com", "/frame_tree/page_with_three_frames.html")); | 1727 "a.com", "/frame_tree/page_with_three_frames.html")); |
| 1761 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1728 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1762 | 1729 |
| 1763 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1730 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1764 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1731 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1765 ->GetFrameTree() | |
| 1766 ->root(); | |
| 1767 | 1732 |
| 1768 EXPECT_EQ( | 1733 EXPECT_EQ( |
| 1769 " Site A ------------ proxies for B\n" | 1734 " Site A ------------ proxies for B\n" |
| 1770 " |--Site B ------- proxies for A\n" | 1735 " |--Site B ------- proxies for A\n" |
| 1771 " |--Site A ------- proxies for B\n" | 1736 " |--Site A ------- proxies for B\n" |
| 1772 " +--Site A ------- proxies for B\n" | 1737 " +--Site A ------- proxies for B\n" |
| 1773 "Where A = http://a.com/\n" | 1738 "Where A = http://a.com/\n" |
| 1774 " B = http://b.com/", | 1739 " B = http://b.com/", |
| 1775 DepictFrameTree(root)); | 1740 DepictFrameTree(root)); |
| 1776 SiteInstance* b_site_instance = | 1741 SiteInstance* b_site_instance = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 // for which its parent has proxies. This includes A. However, even though | 1796 // for which its parent has proxies. This includes A. However, even though |
| 1832 // process A is live (step 4), the parent proxy in A is not live (which was | 1797 // process A is live (step 4), the parent proxy in A is not live (which was |
| 1833 // incorrectly assumed previously). This is because step 4 does not resurrect | 1798 // incorrectly assumed previously). This is because step 4 does not resurrect |
| 1834 // proxies for popups opened before the crash. | 1799 // proxies for popups opened before the crash. |
| 1835 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1800 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1836 CreateChildFrameAfterKillingOpener) { | 1801 CreateChildFrameAfterKillingOpener) { |
| 1837 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1802 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1838 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1803 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1839 | 1804 |
| 1840 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1805 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1841 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1806 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1842 ->GetFrameTree() | |
| 1843 ->root(); | |
| 1844 SiteInstance* site_instance_a = root->current_frame_host()->GetSiteInstance(); | 1807 SiteInstance* site_instance_a = root->current_frame_host()->GetSiteInstance(); |
| 1845 | 1808 |
| 1846 // Open a popup and navigate it cross-process to b.com. | 1809 // Open a popup and navigate it cross-process to b.com. |
| 1847 ShellAddedObserver new_shell_observer; | 1810 ShellAddedObserver new_shell_observer; |
| 1848 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), | 1811 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), |
| 1849 "popup = window.open('about:blank');")); | 1812 "popup = window.open('about:blank');")); |
| 1850 Shell* popup = new_shell_observer.GetShell(); | 1813 Shell* popup = new_shell_observer.GetShell(); |
| 1851 GURL popup_url(embedded_test_server()->GetURL("b.com", "/title2.html")); | 1814 GURL popup_url(embedded_test_server()->GetURL("b.com", "/title2.html")); |
| 1852 EXPECT_TRUE(NavigateToURL(popup, popup_url)); | 1815 EXPECT_TRUE(NavigateToURL(popup, popup_url)); |
| 1853 | 1816 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 // node1 is the root. | 1882 // node1 is the root. |
| 1920 // Initially, both node1.proxy_hosts_ and node3.proxy_hosts_ contain C. | 1883 // Initially, both node1.proxy_hosts_ and node3.proxy_hosts_ contain C. |
| 1921 // After we kill B, make sure proxies for C are cleared. | 1884 // After we kill B, make sure proxies for C are cleared. |
| 1922 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1885 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1923 KillingRendererClearsDescendantProxies) { | 1886 KillingRendererClearsDescendantProxies) { |
| 1924 GURL main_url(embedded_test_server()->GetURL( | 1887 GURL main_url(embedded_test_server()->GetURL( |
| 1925 "a.com", "/frame_tree/page_with_two_frames_nested.html")); | 1888 "a.com", "/frame_tree/page_with_two_frames_nested.html")); |
| 1926 NavigateToURL(shell(), main_url); | 1889 NavigateToURL(shell(), main_url); |
| 1927 | 1890 |
| 1928 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1891 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1929 FrameTreeNode* root = | 1892 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1930 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1931 GetFrameTree()->root(); | |
| 1932 ASSERT_EQ(2U, root->child_count()); | 1893 ASSERT_EQ(2U, root->child_count()); |
| 1933 | 1894 |
| 1934 GURL site_b_url( | 1895 GURL site_b_url( |
| 1935 embedded_test_server()->GetURL( | 1896 embedded_test_server()->GetURL( |
| 1936 "bar.com", "/frame_tree/page_with_one_frame.html")); | 1897 "bar.com", "/frame_tree/page_with_one_frame.html")); |
| 1937 // We can't use a TestNavigationObserver to verify the URL here, | 1898 // We can't use a TestNavigationObserver to verify the URL here, |
| 1938 // since the frame has children that may have clobbered it in the observer. | 1899 // since the frame has children that may have clobbered it in the observer. |
| 1939 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); | 1900 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); |
| 1940 | 1901 |
| 1941 // Ensure that a new process is created for node2. | 1902 // Ensure that a new process is created for node2. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 } | 1954 } |
| 1994 | 1955 |
| 1995 // Crash a subframe and ensures its children are cleared from the FrameTree. | 1956 // Crash a subframe and ensures its children are cleared from the FrameTree. |
| 1996 // See http://crbug.com/338508. | 1957 // See http://crbug.com/338508. |
| 1997 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) { | 1958 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) { |
| 1998 GURL main_url(embedded_test_server()->GetURL( | 1959 GURL main_url(embedded_test_server()->GetURL( |
| 1999 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 1960 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 2000 NavigateToURL(shell(), main_url); | 1961 NavigateToURL(shell(), main_url); |
| 2001 | 1962 |
| 2002 // Check the subframe process. | 1963 // Check the subframe process. |
| 2003 FrameTreeNode* root = | 1964 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2004 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 2005 GetFrameTree()->root(); | |
| 2006 EXPECT_EQ( | 1965 EXPECT_EQ( |
| 2007 " Site A ------------ proxies for B\n" | 1966 " Site A ------------ proxies for B\n" |
| 2008 " +--Site B ------- proxies for A\n" | 1967 " +--Site B ------- proxies for A\n" |
| 2009 "Where A = http://a.com/\n" | 1968 "Where A = http://a.com/\n" |
| 2010 " B = http://b.com/", | 1969 " B = http://b.com/", |
| 2011 DepictFrameTree(root)); | 1970 DepictFrameTree(root)); |
| 2012 FrameTreeNode* child = root->child_at(0); | 1971 FrameTreeNode* child = root->child_at(0); |
| 2013 EXPECT_TRUE( | 1972 EXPECT_TRUE( |
| 2014 child->current_frame_host()->render_view_host()->IsRenderViewLive()); | 1973 child->current_frame_host()->render_view_host()->IsRenderViewLive()); |
| 2015 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive()); | 1974 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 // When a new subframe is added, related SiteInstances that can reach the | 2015 // When a new subframe is added, related SiteInstances that can reach the |
| 2057 // subframe should create proxies for it (https://crbug.com/423587). This test | 2016 // subframe should create proxies for it (https://crbug.com/423587). This test |
| 2058 // checks that if A embeds B and later adds a new subframe A2, A2 gets a proxy | 2017 // checks that if A embeds B and later adds a new subframe A2, A2 gets a proxy |
| 2059 // in B's process. | 2018 // in B's process. |
| 2060 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CreateProxiesForNewFrames) { | 2019 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CreateProxiesForNewFrames) { |
| 2061 GURL main_url(embedded_test_server()->GetURL( | 2020 GURL main_url(embedded_test_server()->GetURL( |
| 2062 "b.com", "/frame_tree/page_with_one_frame.html")); | 2021 "b.com", "/frame_tree/page_with_one_frame.html")); |
| 2063 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2022 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2064 | 2023 |
| 2065 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2024 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2066 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2025 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2067 ->GetFrameTree() | |
| 2068 ->root(); | |
| 2069 ASSERT_EQ(1U, root->child_count()); | 2026 ASSERT_EQ(1U, root->child_count()); |
| 2070 | 2027 |
| 2071 // Make sure the frame starts out at the correct cross-site URL. | 2028 // Make sure the frame starts out at the correct cross-site URL. |
| 2072 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), | 2029 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), |
| 2073 root->child_at(0)->current_url()); | 2030 root->child_at(0)->current_url()); |
| 2074 | 2031 |
| 2075 EXPECT_EQ( | 2032 EXPECT_EQ( |
| 2076 " Site A ------------ proxies for B\n" | 2033 " Site A ------------ proxies for B\n" |
| 2077 " +--Site B ------- proxies for A\n" | 2034 " +--Site B ------- proxies for A\n" |
| 2078 "Where A = http://b.com/\n" | 2035 "Where A = http://b.com/\n" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 | 2258 |
| 2302 // Ensure that when navigating a frame cross-process RenderFrameProxyHosts are | 2259 // Ensure that when navigating a frame cross-process RenderFrameProxyHosts are |
| 2303 // created in the FrameTree skipping the subtree of the navigating frame. | 2260 // created in the FrameTree skipping the subtree of the navigating frame. |
| 2304 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2261 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2305 ProxyCreationSkipsSubtree) { | 2262 ProxyCreationSkipsSubtree) { |
| 2306 GURL main_url(embedded_test_server()->GetURL( | 2263 GURL main_url(embedded_test_server()->GetURL( |
| 2307 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 2264 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 2308 NavigateToURL(shell(), main_url); | 2265 NavigateToURL(shell(), main_url); |
| 2309 | 2266 |
| 2310 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2267 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2311 FrameTreeNode* root = | 2268 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2312 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 2313 GetFrameTree()->root(); | |
| 2314 | 2269 |
| 2315 EXPECT_TRUE(root->child_at(1) != NULL); | 2270 EXPECT_TRUE(root->child_at(1) != NULL); |
| 2316 EXPECT_EQ(2U, root->child_at(1)->child_count()); | 2271 EXPECT_EQ(2U, root->child_at(1)->child_count()); |
| 2317 | 2272 |
| 2318 { | 2273 { |
| 2319 // Load same-site page into iframe. | 2274 // Load same-site page into iframe. |
| 2320 TestNavigationObserver observer(shell()->web_contents()); | 2275 TestNavigationObserver observer(shell()->web_contents()); |
| 2321 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 2276 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 2322 NavigateFrameToURL(root->child_at(0), http_url); | 2277 NavigateFrameToURL(root->child_at(0), http_url); |
| 2323 EXPECT_EQ(http_url, observer.last_navigation_url()); | 2278 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2449 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2404 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2450 MAYBE_FrameOwnerPropertiesPropagationScrolling) { | 2405 MAYBE_FrameOwnerPropertiesPropagationScrolling) { |
| 2451 #if defined(OS_MACOSX) | 2406 #if defined(OS_MACOSX) |
| 2452 ui::test::ScopedPreferredScrollerStyle scroller_style_override(false); | 2407 ui::test::ScopedPreferredScrollerStyle scroller_style_override(false); |
| 2453 #endif | 2408 #endif |
| 2454 GURL main_url(embedded_test_server()->GetURL( | 2409 GURL main_url(embedded_test_server()->GetURL( |
| 2455 "a.com", "/frame_owner_properties_scrolling.html")); | 2410 "a.com", "/frame_owner_properties_scrolling.html")); |
| 2456 NavigateToURL(shell(), main_url); | 2411 NavigateToURL(shell(), main_url); |
| 2457 | 2412 |
| 2458 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2413 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2459 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2414 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2460 ->GetFrameTree() | |
| 2461 ->root(); | |
| 2462 ASSERT_EQ(1u, root->child_count()); | 2415 ASSERT_EQ(1u, root->child_count()); |
| 2463 | 2416 |
| 2464 EXPECT_EQ( | 2417 EXPECT_EQ( |
| 2465 " Site A ------------ proxies for B\n" | 2418 " Site A ------------ proxies for B\n" |
| 2466 " +--Site B ------- proxies for A\n" | 2419 " +--Site B ------- proxies for A\n" |
| 2467 "Where A = http://a.com/\n" | 2420 "Where A = http://a.com/\n" |
| 2468 " B = http://b.com/", | 2421 " B = http://b.com/", |
| 2469 DepictFrameTree(root)); | 2422 DepictFrameTree(root)); |
| 2470 | 2423 |
| 2471 FrameTreeNode* child = root->child_at(0); | 2424 FrameTreeNode* child = root->child_at(0); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 | 2470 |
| 2518 // Verify that "marginwidth" and "marginheight" properties on frame elements | 2471 // Verify that "marginwidth" and "marginheight" properties on frame elements |
| 2519 // propagate to child frames correctly. | 2472 // propagate to child frames correctly. |
| 2520 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2473 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2521 FrameOwnerPropertiesPropagationMargin) { | 2474 FrameOwnerPropertiesPropagationMargin) { |
| 2522 GURL main_url(embedded_test_server()->GetURL( | 2475 GURL main_url(embedded_test_server()->GetURL( |
| 2523 "a.com", "/frame_owner_properties_margin.html")); | 2476 "a.com", "/frame_owner_properties_margin.html")); |
| 2524 NavigateToURL(shell(), main_url); | 2477 NavigateToURL(shell(), main_url); |
| 2525 | 2478 |
| 2526 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2479 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2527 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2480 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2528 ->GetFrameTree() | |
| 2529 ->root(); | |
| 2530 ASSERT_EQ(1u, root->child_count()); | 2481 ASSERT_EQ(1u, root->child_count()); |
| 2531 | 2482 |
| 2532 EXPECT_EQ( | 2483 EXPECT_EQ( |
| 2533 " Site A ------------ proxies for B\n" | 2484 " Site A ------------ proxies for B\n" |
| 2534 " +--Site B ------- proxies for A\n" | 2485 " +--Site B ------- proxies for A\n" |
| 2535 "Where A = http://a.com/\n" | 2486 "Where A = http://a.com/\n" |
| 2536 " B = http://b.com/", | 2487 " B = http://b.com/", |
| 2537 DepictFrameTree(root)); | 2488 DepictFrameTree(root)); |
| 2538 | 2489 |
| 2539 FrameTreeNode* child = root->child_at(0); | 2490 FrameTreeNode* child = root->child_at(0); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 } | 2557 } |
| 2607 } | 2558 } |
| 2608 | 2559 |
| 2609 // Verify origin replication with an A-embed-B-embed-C-embed-A hierarchy. | 2560 // Verify origin replication with an A-embed-B-embed-C-embed-A hierarchy. |
| 2610 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginReplication) { | 2561 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginReplication) { |
| 2611 GURL main_url(embedded_test_server()->GetURL( | 2562 GURL main_url(embedded_test_server()->GetURL( |
| 2612 "a.com", "/cross_site_iframe_factory.html?a(b(c(a),b), a)")); | 2563 "a.com", "/cross_site_iframe_factory.html?a(b(c(a),b), a)")); |
| 2613 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2564 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2614 | 2565 |
| 2615 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2566 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2616 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2567 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2617 ->GetFrameTree() | |
| 2618 ->root(); | |
| 2619 | 2568 |
| 2620 EXPECT_EQ( | 2569 EXPECT_EQ( |
| 2621 " Site A ------------ proxies for B C\n" | 2570 " Site A ------------ proxies for B C\n" |
| 2622 " |--Site B ------- proxies for A C\n" // tiptop_child | 2571 " |--Site B ------- proxies for A C\n" // tiptop_child |
| 2623 " | |--Site C -- proxies for A B\n" // middle_child | 2572 " | |--Site C -- proxies for A B\n" // middle_child |
| 2624 " | | +--Site A -- proxies for B C\n" // lowest_child | 2573 " | | +--Site A -- proxies for B C\n" // lowest_child |
| 2625 " | +--Site B -- proxies for A C\n" | 2574 " | +--Site B -- proxies for A C\n" |
| 2626 " +--Site A ------- proxies for B C\n" | 2575 " +--Site A ------- proxies for B C\n" |
| 2627 "Where A = http://a.com/\n" | 2576 "Where A = http://a.com/\n" |
| 2628 " B = http://b.com/\n" | 2577 " B = http://b.com/\n" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2697 &result)); | 2646 &result)); |
| 2698 EXPECT_EQ(a_origin, result + "/"); | 2647 EXPECT_EQ(a_origin, result + "/"); |
| 2699 } | 2648 } |
| 2700 | 2649 |
| 2701 // Check that iframe sandbox flags are replicated correctly. | 2650 // Check that iframe sandbox flags are replicated correctly. |
| 2702 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsReplication) { | 2651 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsReplication) { |
| 2703 GURL main_url(embedded_test_server()->GetURL("/sandboxed_frames.html")); | 2652 GURL main_url(embedded_test_server()->GetURL("/sandboxed_frames.html")); |
| 2704 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2653 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2705 | 2654 |
| 2706 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2655 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2707 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2656 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2708 ->GetFrameTree() | |
| 2709 ->root(); | |
| 2710 | 2657 |
| 2711 TestNavigationObserver observer(shell()->web_contents()); | 2658 TestNavigationObserver observer(shell()->web_contents()); |
| 2712 | 2659 |
| 2713 // Navigate the second (sandboxed) subframe to a cross-site page with a | 2660 // Navigate the second (sandboxed) subframe to a cross-site page with a |
| 2714 // subframe. | 2661 // subframe. |
| 2715 GURL foo_url( | 2662 GURL foo_url( |
| 2716 embedded_test_server()->GetURL("foo.com", "/frame_tree/1-1.html")); | 2663 embedded_test_server()->GetURL("foo.com", "/frame_tree/1-1.html")); |
| 2717 NavigateFrameToURL(root->child_at(1), foo_url); | 2664 NavigateFrameToURL(root->child_at(1), foo_url); |
| 2718 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 2665 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
| 2719 | 2666 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 EXPECT_EQ(main_url.GetOrigin().spec(), result + "/"); | 2744 EXPECT_EQ(main_url.GetOrigin().spec(), result + "/"); |
| 2798 } | 2745 } |
| 2799 | 2746 |
| 2800 // Check that dynamic updates to iframe sandbox flags are propagated correctly. | 2747 // Check that dynamic updates to iframe sandbox flags are propagated correctly. |
| 2801 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicSandboxFlags) { | 2748 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicSandboxFlags) { |
| 2802 GURL main_url( | 2749 GURL main_url( |
| 2803 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 2750 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 2804 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2751 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2805 | 2752 |
| 2806 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2753 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2807 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2754 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2808 ->GetFrameTree() | |
| 2809 ->root(); | |
| 2810 | 2755 |
| 2811 TestNavigationObserver observer(shell()->web_contents()); | 2756 TestNavigationObserver observer(shell()->web_contents()); |
| 2812 ASSERT_EQ(2U, root->child_count()); | 2757 ASSERT_EQ(2U, root->child_count()); |
| 2813 | 2758 |
| 2814 // Make sure first frame starts out at the correct cross-site page. | 2759 // Make sure first frame starts out at the correct cross-site page. |
| 2815 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), | 2760 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), |
| 2816 root->child_at(0)->current_url()); | 2761 root->child_at(0)->current_url()); |
| 2817 | 2762 |
| 2818 // Navigate second frame to another cross-site page. | 2763 // Navigate second frame to another cross-site page. |
| 2819 GURL baz_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 2764 GURL baz_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2921 } | 2866 } |
| 2922 | 2867 |
| 2923 // Check that dynamic updates to iframe sandbox flags are propagated correctly. | 2868 // Check that dynamic updates to iframe sandbox flags are propagated correctly. |
| 2924 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2869 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2925 DynamicSandboxFlagsRemoteToLocal) { | 2870 DynamicSandboxFlagsRemoteToLocal) { |
| 2926 GURL main_url( | 2871 GURL main_url( |
| 2927 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 2872 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 2928 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2873 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2929 | 2874 |
| 2930 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2875 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2931 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2876 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2932 ->GetFrameTree() | |
| 2933 ->root(); | |
| 2934 | 2877 |
| 2935 TestNavigationObserver observer(shell()->web_contents()); | 2878 TestNavigationObserver observer(shell()->web_contents()); |
| 2936 ASSERT_EQ(2U, root->child_count()); | 2879 ASSERT_EQ(2U, root->child_count()); |
| 2937 | 2880 |
| 2938 // Make sure the two frames starts out at correct URLs. | 2881 // Make sure the two frames starts out at correct URLs. |
| 2939 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), | 2882 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), |
| 2940 root->child_at(0)->current_url()); | 2883 root->child_at(0)->current_url()); |
| 2941 EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"), | 2884 EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"), |
| 2942 root->child_at(1)->current_url()); | 2885 root->child_at(1)->current_url()); |
| 2943 | 2886 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2991 } | 2934 } |
| 2992 | 2935 |
| 2993 // Check that dynamic updates to iframe sandbox flags are propagated correctly. | 2936 // Check that dynamic updates to iframe sandbox flags are propagated correctly. |
| 2994 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2937 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2995 DynamicSandboxFlagsRendererInitiatedNavigation) { | 2938 DynamicSandboxFlagsRendererInitiatedNavigation) { |
| 2996 GURL main_url( | 2939 GURL main_url( |
| 2997 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); | 2940 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); |
| 2998 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2941 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2999 | 2942 |
| 3000 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2943 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3001 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2944 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3002 ->GetFrameTree() | |
| 3003 ->root(); | |
| 3004 | 2945 |
| 3005 TestNavigationObserver observer(shell()->web_contents()); | 2946 TestNavigationObserver observer(shell()->web_contents()); |
| 3006 ASSERT_EQ(1U, root->child_count()); | 2947 ASSERT_EQ(1U, root->child_count()); |
| 3007 | 2948 |
| 3008 // Make sure the frame starts out at the correct cross-site page. | 2949 // Make sure the frame starts out at the correct cross-site page. |
| 3009 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), | 2950 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), |
| 3010 root->child_at(0)->current_url()); | 2951 root->child_at(0)->current_url()); |
| 3011 | 2952 |
| 3012 // The frame should not be sandboxed to start with. | 2953 // The frame should not be sandboxed to start with. |
| 3013 EXPECT_EQ(blink::WebSandboxFlags::None, | 2954 EXPECT_EQ(blink::WebSandboxFlags::None, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 // checking whether the grandchild frame added in step 3 sees proper sandbox | 3013 // checking whether the grandchild frame added in step 3 sees proper sandbox |
| 3073 // flags and origin for its (remote) parent. This wasn't addressed when | 3014 // flags and origin for its (remote) parent. This wasn't addressed when |
| 3074 // https://crbug.com/423587 was fixed. | 3015 // https://crbug.com/423587 was fixed. |
| 3075 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3016 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3076 ProxiesForNewChildFramesHaveCorrectReplicationState) { | 3017 ProxiesForNewChildFramesHaveCorrectReplicationState) { |
| 3077 GURL main_url( | 3018 GURL main_url( |
| 3078 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); | 3019 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); |
| 3079 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3020 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3080 | 3021 |
| 3081 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3022 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3082 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3023 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3083 ->GetFrameTree() | |
| 3084 ->root(); | |
| 3085 TestNavigationObserver observer(shell()->web_contents()); | 3024 TestNavigationObserver observer(shell()->web_contents()); |
| 3086 | 3025 |
| 3087 EXPECT_EQ( | 3026 EXPECT_EQ( |
| 3088 " Site A ------------ proxies for B\n" | 3027 " Site A ------------ proxies for B\n" |
| 3089 " +--Site B ------- proxies for A\n" | 3028 " +--Site B ------- proxies for A\n" |
| 3090 "Where A = http://127.0.0.1/\n" | 3029 "Where A = http://127.0.0.1/\n" |
| 3091 " B = http://baz.com/", | 3030 " B = http://baz.com/", |
| 3092 DepictFrameTree(root)); | 3031 DepictFrameTree(root)); |
| 3093 | 3032 |
| 3094 // In the root frame, add a new sandboxed local frame, which itself has a | 3033 // In the root frame, add a new sandboxed local frame, which itself has a |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3153 EXPECT_TRUE(success); | 3092 EXPECT_TRUE(success); |
| 3154 EXPECT_EQ(1u, Shell::windows().size()); | 3093 EXPECT_EQ(1u, Shell::windows().size()); |
| 3155 } | 3094 } |
| 3156 | 3095 |
| 3157 // Verify that a child frame can retrieve the name property set by its parent. | 3096 // Verify that a child frame can retrieve the name property set by its parent. |
| 3158 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, WindowNameReplication) { | 3097 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, WindowNameReplication) { |
| 3159 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); | 3098 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); |
| 3160 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3099 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3161 | 3100 |
| 3162 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3101 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3163 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3102 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3164 ->GetFrameTree() | |
| 3165 ->root(); | |
| 3166 | 3103 |
| 3167 TestNavigationObserver observer(shell()->web_contents()); | 3104 TestNavigationObserver observer(shell()->web_contents()); |
| 3168 | 3105 |
| 3169 // Load cross-site page into iframe. | 3106 // Load cross-site page into iframe. |
| 3170 GURL frame_url = | 3107 GURL frame_url = |
| 3171 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); | 3108 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); |
| 3172 NavigateFrameToURL(root->child_at(0), frame_url); | 3109 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3173 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3110 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3174 EXPECT_EQ(frame_url, observer.last_navigation_url()); | 3111 EXPECT_EQ(frame_url, observer.last_navigation_url()); |
| 3175 | 3112 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3186 EXPECT_EQ("3-1-name", result); | 3123 EXPECT_EQ("3-1-name", result); |
| 3187 } | 3124 } |
| 3188 | 3125 |
| 3189 // Verify that dynamic updates to a frame's window.name propagate to the | 3126 // Verify that dynamic updates to a frame's window.name propagate to the |
| 3190 // frame's proxies, so that the latest frame names can be used in navigations. | 3127 // frame's proxies, so that the latest frame names can be used in navigations. |
| 3191 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicWindowName) { | 3128 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicWindowName) { |
| 3192 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); | 3129 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); |
| 3193 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3130 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3194 | 3131 |
| 3195 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3132 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3196 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3133 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3197 ->GetFrameTree() | |
| 3198 ->root(); | |
| 3199 TestNavigationObserver observer(shell()->web_contents()); | 3134 TestNavigationObserver observer(shell()->web_contents()); |
| 3200 | 3135 |
| 3201 // Load cross-site page into iframe. | 3136 // Load cross-site page into iframe. |
| 3202 GURL frame_url = | 3137 GURL frame_url = |
| 3203 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); | 3138 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); |
| 3204 NavigateFrameToURL(root->child_at(0), frame_url); | 3139 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3205 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3140 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3206 EXPECT_EQ(frame_url, observer.last_navigation_url()); | 3141 EXPECT_EQ(frame_url, observer.last_navigation_url()); |
| 3207 | 3142 |
| 3208 // Browser process should know the child frame's original window.name | 3143 // Browser process should know the child frame's original window.name |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3245 } | 3180 } |
| 3246 | 3181 |
| 3247 // Verify that when a frame is navigated to a new origin, the origin update | 3182 // Verify that when a frame is navigated to a new origin, the origin update |
| 3248 // propagates to the frame's proxies. | 3183 // propagates to the frame's proxies. |
| 3249 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginUpdatesReachProxies) { | 3184 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginUpdatesReachProxies) { |
| 3250 GURL main_url( | 3185 GURL main_url( |
| 3251 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 3186 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 3252 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3187 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3253 | 3188 |
| 3254 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3189 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3255 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3190 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3256 ->GetFrameTree() | |
| 3257 ->root(); | |
| 3258 TestNavigationObserver observer(shell()->web_contents()); | 3191 TestNavigationObserver observer(shell()->web_contents()); |
| 3259 | 3192 |
| 3260 EXPECT_EQ( | 3193 EXPECT_EQ( |
| 3261 " Site A ------------ proxies for B\n" | 3194 " Site A ------------ proxies for B\n" |
| 3262 " |--Site B ------- proxies for A\n" | 3195 " |--Site B ------- proxies for A\n" |
| 3263 " +--Site A ------- proxies for B\n" | 3196 " +--Site A ------- proxies for B\n" |
| 3264 "Where A = http://127.0.0.1/\n" | 3197 "Where A = http://127.0.0.1/\n" |
| 3265 " B = http://bar.com/", | 3198 " B = http://bar.com/", |
| 3266 DepictFrameTree(root)); | 3199 DepictFrameTree(root)); |
| 3267 | 3200 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3298 << frame_origin << ")"; | 3231 << frame_origin << ")"; |
| 3299 } | 3232 } |
| 3300 | 3233 |
| 3301 // Ensure that navigating subframes in --site-per-process mode properly fires | 3234 // Ensure that navigating subframes in --site-per-process mode properly fires |
| 3302 // the DidStopLoading event on WebContentsObserver. | 3235 // the DidStopLoading event on WebContentsObserver. |
| 3303 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { | 3236 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { |
| 3304 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 3237 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 3305 NavigateToURL(shell(), main_url); | 3238 NavigateToURL(shell(), main_url); |
| 3306 | 3239 |
| 3307 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3240 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3308 FrameTreeNode* root = | 3241 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3309 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 3310 GetFrameTree()->root(); | |
| 3311 | 3242 |
| 3312 TestNavigationObserver observer(shell()->web_contents()); | 3243 TestNavigationObserver observer(shell()->web_contents()); |
| 3313 | 3244 |
| 3314 // Load same-site page into iframe. | 3245 // Load same-site page into iframe. |
| 3315 FrameTreeNode* child = root->child_at(0); | 3246 FrameTreeNode* child = root->child_at(0); |
| 3316 GURL http_url(embedded_test_server()->GetURL("/title1.html")); | 3247 GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
| 3317 NavigateFrameToURL(child, http_url); | 3248 NavigateFrameToURL(child, http_url); |
| 3318 EXPECT_EQ(http_url, observer.last_navigation_url()); | 3249 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 3319 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3250 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3320 | 3251 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3334 | 3265 |
| 3335 // Ensure that the renderer does not crash when navigating a frame that has a | 3266 // Ensure that the renderer does not crash when navigating a frame that has a |
| 3336 // sibling RemoteFrame. See https://crbug.com/426953. | 3267 // sibling RemoteFrame. See https://crbug.com/426953. |
| 3337 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3268 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3338 NavigateWithSiblingRemoteFrame) { | 3269 NavigateWithSiblingRemoteFrame) { |
| 3339 GURL main_url( | 3270 GURL main_url( |
| 3340 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 3271 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 3341 NavigateToURL(shell(), main_url); | 3272 NavigateToURL(shell(), main_url); |
| 3342 | 3273 |
| 3343 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3274 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3344 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3275 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3345 ->GetFrameTree() | |
| 3346 ->root(); | |
| 3347 TestNavigationObserver observer(shell()->web_contents()); | 3276 TestNavigationObserver observer(shell()->web_contents()); |
| 3348 | 3277 |
| 3349 // Make sure the first frame is out of process. | 3278 // Make sure the first frame is out of process. |
| 3350 ASSERT_EQ(2U, root->child_count()); | 3279 ASSERT_EQ(2U, root->child_count()); |
| 3351 FrameTreeNode* node2 = root->child_at(0); | 3280 FrameTreeNode* node2 = root->child_at(0); |
| 3352 EXPECT_NE(root->current_frame_host()->GetSiteInstance(), | 3281 EXPECT_NE(root->current_frame_host()->GetSiteInstance(), |
| 3353 node2->current_frame_host()->GetSiteInstance()); | 3282 node2->current_frame_host()->GetSiteInstance()); |
| 3354 | 3283 |
| 3355 // Make sure the second frame is in the parent's process. | 3284 // Make sure the second frame is in the parent's process. |
| 3356 FrameTreeNode* node3 = root->child_at(1); | 3285 FrameTreeNode* node3 = root->child_at(1); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3370 // Ensure that the renderer does not crash when a local frame with a remote | 3299 // Ensure that the renderer does not crash when a local frame with a remote |
| 3371 // parent frame is swapped from local to remote, then back to local again. | 3300 // parent frame is swapped from local to remote, then back to local again. |
| 3372 // See https://crbug.com/585654. | 3301 // See https://crbug.com/585654. |
| 3373 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3302 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3374 NavigateSiblingsToSameProcess) { | 3303 NavigateSiblingsToSameProcess) { |
| 3375 GURL main_url( | 3304 GURL main_url( |
| 3376 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 3305 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 3377 NavigateToURL(shell(), main_url); | 3306 NavigateToURL(shell(), main_url); |
| 3378 | 3307 |
| 3379 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3308 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3380 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3309 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3381 ->GetFrameTree() | |
| 3382 ->root(); | |
| 3383 | 3310 |
| 3384 FrameTreeNode* node2 = root->child_at(0); | 3311 FrameTreeNode* node2 = root->child_at(0); |
| 3385 FrameTreeNode* node3 = root->child_at(1); | 3312 FrameTreeNode* node3 = root->child_at(1); |
| 3386 | 3313 |
| 3387 // Navigate the second iframe to the same process as the first. | 3314 // Navigate the second iframe to the same process as the first. |
| 3388 GURL frame_url = embedded_test_server()->GetURL("bar.com", "/title1.html"); | 3315 GURL frame_url = embedded_test_server()->GetURL("bar.com", "/title1.html"); |
| 3389 NavigateFrameToURL(node3, frame_url); | 3316 NavigateFrameToURL(node3, frame_url); |
| 3390 | 3317 |
| 3391 // Verify that they are in the same process. | 3318 // Verify that they are in the same process. |
| 3392 EXPECT_EQ(node2->current_frame_host()->GetSiteInstance(), | 3319 EXPECT_EQ(node2->current_frame_host()->GetSiteInstance(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3417 { | 3344 { |
| 3418 GURL main_url( | 3345 GURL main_url( |
| 3419 embedded_test_server()->GetURL("/frame_with_load_event.html")); | 3346 embedded_test_server()->GetURL("/frame_with_load_event.html")); |
| 3420 base::string16 expected_title(base::UTF8ToUTF16("LOADED")); | 3347 base::string16 expected_title(base::UTF8ToUTF16("LOADED")); |
| 3421 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 3348 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 3422 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3349 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3423 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); | 3350 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); |
| 3424 } | 3351 } |
| 3425 | 3352 |
| 3426 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3353 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3427 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3354 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3428 ->GetFrameTree() | |
| 3429 ->root(); | |
| 3430 | 3355 |
| 3431 // Load another cross-site page into the iframe and check that the load event | 3356 // Load another cross-site page into the iframe and check that the load event |
| 3432 // is fired. | 3357 // is fired. |
| 3433 { | 3358 { |
| 3434 GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); | 3359 GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); |
| 3435 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED")); | 3360 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED")); |
| 3436 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 3361 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 3437 TestNavigationObserver observer(shell()->web_contents()); | 3362 TestNavigationObserver observer(shell()->web_contents()); |
| 3438 NavigateFrameToURL(root->child_at(0), foo_url); | 3363 NavigateFrameToURL(root->child_at(0), foo_url); |
| 3439 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3364 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3440 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 3365 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 3441 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); | 3366 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); |
| 3442 } | 3367 } |
| 3443 } | 3368 } |
| 3444 | 3369 |
| 3445 // Check that postMessage can be routed between cross-site iframes. | 3370 // Check that postMessage can be routed between cross-site iframes. |
| 3446 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframePostMessage) { | 3371 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframePostMessage) { |
| 3447 GURL main_url(embedded_test_server()->GetURL( | 3372 GURL main_url(embedded_test_server()->GetURL( |
| 3448 "/frame_tree/page_with_post_message_frames.html")); | 3373 "/frame_tree/page_with_post_message_frames.html")); |
| 3449 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3374 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3450 | 3375 |
| 3451 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3376 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3452 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3377 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3453 ->GetFrameTree() | |
| 3454 ->root(); | |
| 3455 | 3378 |
| 3456 ASSERT_EQ(2U, root->child_count()); | 3379 ASSERT_EQ(2U, root->child_count()); |
| 3457 | 3380 |
| 3458 // Verify the frames start at correct URLs. First frame should be | 3381 // Verify the frames start at correct URLs. First frame should be |
| 3459 // same-site; second frame should be cross-site. | 3382 // same-site; second frame should be cross-site. |
| 3460 GURL same_site_url(embedded_test_server()->GetURL("/post_message.html")); | 3383 GURL same_site_url(embedded_test_server()->GetURL("/post_message.html")); |
| 3461 EXPECT_EQ(same_site_url, root->child_at(0)->current_url()); | 3384 EXPECT_EQ(same_site_url, root->child_at(0)->current_url()); |
| 3462 GURL foo_url(embedded_test_server()->GetURL("foo.com", | 3385 GURL foo_url(embedded_test_server()->GetURL("foo.com", |
| 3463 "/post_message.html")); | 3386 "/post_message.html")); |
| 3464 EXPECT_EQ(foo_url, root->child_at(1)->current_url()); | 3387 EXPECT_EQ(foo_url, root->child_at(1)->current_url()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 3490 | 3413 |
| 3491 // Check that postMessage can be sent from a subframe on a cross-process opener | 3414 // Check that postMessage can be sent from a subframe on a cross-process opener |
| 3492 // tab, and that its event.source points to a valid proxy. | 3415 // tab, and that its event.source points to a valid proxy. |
| 3493 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3416 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3494 PostMessageWithSubframeOnOpenerChain) { | 3417 PostMessageWithSubframeOnOpenerChain) { |
| 3495 GURL main_url(embedded_test_server()->GetURL( | 3418 GURL main_url(embedded_test_server()->GetURL( |
| 3496 "a.com", "/frame_tree/page_with_post_message_frames.html")); | 3419 "a.com", "/frame_tree/page_with_post_message_frames.html")); |
| 3497 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3420 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3498 | 3421 |
| 3499 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3422 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3500 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3423 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3501 ->GetFrameTree() | |
| 3502 ->root(); | |
| 3503 | 3424 |
| 3504 ASSERT_EQ(2U, root->child_count()); | 3425 ASSERT_EQ(2U, root->child_count()); |
| 3505 | 3426 |
| 3506 // Verify the initial state of the world. First frame should be same-site; | 3427 // Verify the initial state of the world. First frame should be same-site; |
| 3507 // second frame should be cross-site. | 3428 // second frame should be cross-site. |
| 3508 EXPECT_EQ( | 3429 EXPECT_EQ( |
| 3509 " Site A ------------ proxies for B\n" | 3430 " Site A ------------ proxies for B\n" |
| 3510 " |--Site A ------- proxies for B\n" | 3431 " |--Site A ------- proxies for B\n" |
| 3511 " +--Site B ------- proxies for A\n" | 3432 " +--Site B ------- proxies for A\n" |
| 3512 "Where A = http://a.com/\n" | 3433 "Where A = http://a.com/\n" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3601 | 3522 |
| 3602 // Check that parent.frames[num] references correct sibling frames when the | 3523 // Check that parent.frames[num] references correct sibling frames when the |
| 3603 // parent is remote. See https://crbug.com/478792. | 3524 // parent is remote. See https://crbug.com/478792. |
| 3604 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, IndexedFrameAccess) { | 3525 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, IndexedFrameAccess) { |
| 3605 // Start on a page with three same-site subframes. | 3526 // Start on a page with three same-site subframes. |
| 3606 GURL main_url( | 3527 GURL main_url( |
| 3607 embedded_test_server()->GetURL("a.com", "/frame_tree/top.html")); | 3528 embedded_test_server()->GetURL("a.com", "/frame_tree/top.html")); |
| 3608 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3529 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3609 | 3530 |
| 3610 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3531 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3611 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3532 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3612 ->GetFrameTree() | |
| 3613 ->root(); | |
| 3614 ASSERT_EQ(3U, root->child_count()); | 3533 ASSERT_EQ(3U, root->child_count()); |
| 3615 FrameTreeNode* child0 = root->child_at(0); | 3534 FrameTreeNode* child0 = root->child_at(0); |
| 3616 FrameTreeNode* child1 = root->child_at(1); | 3535 FrameTreeNode* child1 = root->child_at(1); |
| 3617 FrameTreeNode* child2 = root->child_at(2); | 3536 FrameTreeNode* child2 = root->child_at(2); |
| 3618 | 3537 |
| 3619 // Send each of the frames to a different site. Each new renderer will first | 3538 // Send each of the frames to a different site. Each new renderer will first |
| 3620 // create proxies for the parent and two sibling subframes and then create | 3539 // create proxies for the parent and two sibling subframes and then create |
| 3621 // and insert the new RenderFrame into the frame tree. | 3540 // and insert the new RenderFrame into the frame tree. |
| 3622 GURL b_url(embedded_test_server()->GetURL("b.com", "/post_message.html")); | 3541 GURL b_url(embedded_test_server()->GetURL("b.com", "/post_message.html")); |
| 3623 GURL c_url(embedded_test_server()->GetURL("c.com", "/post_message.html")); | 3542 GURL c_url(embedded_test_server()->GetURL("c.com", "/post_message.html")); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3673 EXPECT_EQ(1, GetReceivedMessages(child0)); | 3592 EXPECT_EQ(1, GetReceivedMessages(child0)); |
| 3674 EXPECT_EQ(2, GetReceivedMessages(child1)); | 3593 EXPECT_EQ(2, GetReceivedMessages(child1)); |
| 3675 EXPECT_EQ(1, GetReceivedMessages(child2)); | 3594 EXPECT_EQ(1, GetReceivedMessages(child2)); |
| 3676 } | 3595 } |
| 3677 | 3596 |
| 3678 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RFPHDestruction) { | 3597 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RFPHDestruction) { |
| 3679 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 3598 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 3680 NavigateToURL(shell(), main_url); | 3599 NavigateToURL(shell(), main_url); |
| 3681 | 3600 |
| 3682 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3601 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3683 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3602 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3684 ->GetFrameTree() | |
| 3685 ->root(); | |
| 3686 | 3603 |
| 3687 TestNavigationObserver observer(shell()->web_contents()); | 3604 TestNavigationObserver observer(shell()->web_contents()); |
| 3688 | 3605 |
| 3689 // Load cross-site page into iframe. | 3606 // Load cross-site page into iframe. |
| 3690 FrameTreeNode* child = root->child_at(0); | 3607 FrameTreeNode* child = root->child_at(0); |
| 3691 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 3608 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 3692 NavigateFrameToURL(root->child_at(0), url); | 3609 NavigateFrameToURL(root->child_at(0), url); |
| 3693 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3610 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3694 EXPECT_EQ(url, observer.last_navigation_url()); | 3611 EXPECT_EQ(url, observer.last_navigation_url()); |
| 3695 EXPECT_EQ( | 3612 EXPECT_EQ( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3734 "Where A = http://127.0.0.1/", | 3651 "Where A = http://127.0.0.1/", |
| 3735 DepictFrameTree(root)); | 3652 DepictFrameTree(root)); |
| 3736 } | 3653 } |
| 3737 | 3654 |
| 3738 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) { | 3655 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) { |
| 3739 GURL main_url( | 3656 GURL main_url( |
| 3740 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | 3657 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); |
| 3741 NavigateToURL(shell(), main_url); | 3658 NavigateToURL(shell(), main_url); |
| 3742 | 3659 |
| 3743 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3660 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3744 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3661 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3745 ->GetFrameTree() | |
| 3746 ->root(); | |
| 3747 | 3662 |
| 3748 // Navigate first child cross-site. | 3663 // Navigate first child cross-site. |
| 3749 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 3664 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 3750 NavigateFrameToURL(root->child_at(0), frame_url); | 3665 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3751 | 3666 |
| 3752 // Open a popup from the first child. | 3667 // Open a popup from the first child. |
| 3753 Shell* new_shell = OpenPopup(root->child_at(0)->current_frame_host(), | 3668 Shell* new_shell = OpenPopup(root->child_at(0)->current_frame_host(), |
| 3754 GURL(url::kAboutBlankURL), ""); | 3669 GURL(url::kAboutBlankURL), ""); |
| 3755 EXPECT_TRUE(new_shell); | 3670 EXPECT_TRUE(new_shell); |
| 3756 | 3671 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3838 | 3753 |
| 3839 // Verify that named frames are discoverable from their opener's ancestors. | 3754 // Verify that named frames are discoverable from their opener's ancestors. |
| 3840 // See https://crbug.com/511474. | 3755 // See https://crbug.com/511474. |
| 3841 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3756 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3842 DiscoverNamedFrameFromAncestorOfOpener) { | 3757 DiscoverNamedFrameFromAncestorOfOpener) { |
| 3843 GURL main_url( | 3758 GURL main_url( |
| 3844 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | 3759 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); |
| 3845 NavigateToURL(shell(), main_url); | 3760 NavigateToURL(shell(), main_url); |
| 3846 | 3761 |
| 3847 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3762 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3848 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3763 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3849 ->GetFrameTree() | |
| 3850 ->root(); | |
| 3851 | 3764 |
| 3852 // Navigate first child cross-site. | 3765 // Navigate first child cross-site. |
| 3853 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 3766 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 3854 NavigateFrameToURL(root->child_at(0), frame_url); | 3767 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3855 | 3768 |
| 3856 // Open a popup named "foo" from the first child. | 3769 // Open a popup named "foo" from the first child. |
| 3857 Shell* foo_shell = OpenPopup(root->child_at(0)->current_frame_host(), | 3770 Shell* foo_shell = OpenPopup(root->child_at(0)->current_frame_host(), |
| 3858 GURL(url::kAboutBlankURL), "foo"); | 3771 GURL(url::kAboutBlankURL), "foo"); |
| 3859 EXPECT_TRUE(foo_shell); | 3772 EXPECT_TRUE(foo_shell); |
| 3860 | 3773 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 3891 // still be discoverable from its opener's ancestors. Also, instead of using | 3804 // still be discoverable from its opener's ancestors. Also, instead of using |
| 3892 // an opener's ancestor, this test uses a popup with same origin as that | 3805 // an opener's ancestor, this test uses a popup with same origin as that |
| 3893 // ancestor. See https://crbug.com/511474. | 3806 // ancestor. See https://crbug.com/511474. |
| 3894 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3807 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3895 DiscoverFrameAfterSettingWindowName) { | 3808 DiscoverFrameAfterSettingWindowName) { |
| 3896 GURL main_url( | 3809 GURL main_url( |
| 3897 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | 3810 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); |
| 3898 NavigateToURL(shell(), main_url); | 3811 NavigateToURL(shell(), main_url); |
| 3899 | 3812 |
| 3900 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3813 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3901 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3814 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3902 ->GetFrameTree() | |
| 3903 ->root(); | |
| 3904 | 3815 |
| 3905 // Open a same-site popup from the main frame. | 3816 // Open a same-site popup from the main frame. |
| 3906 GURL a_com_url(embedded_test_server()->GetURL("a.com", "/title3.html")); | 3817 GURL a_com_url(embedded_test_server()->GetURL("a.com", "/title3.html")); |
| 3907 Shell* a_com_shell = | 3818 Shell* a_com_shell = |
| 3908 OpenPopup(root->child_at(0)->current_frame_host(), a_com_url, ""); | 3819 OpenPopup(root->child_at(0)->current_frame_host(), a_com_url, ""); |
| 3909 EXPECT_TRUE(a_com_shell); | 3820 EXPECT_TRUE(a_com_shell); |
| 3910 | 3821 |
| 3911 // Navigate first child on main frame cross-site. | 3822 // Navigate first child on main frame cross-site. |
| 3912 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 3823 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 3913 NavigateFrameToURL(root->child_at(0), frame_url); | 3824 NavigateFrameToURL(root->child_at(0), frame_url); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3951 // ^ | | 3862 // ^ | |
| 3952 // +--------------------+ | 3863 // +--------------------+ |
| 3953 // | 3864 // |
| 3954 // The sites are carefully set up so that both opener updates are cross-process | 3865 // The sites are carefully set up so that both opener updates are cross-process |
| 3955 // but still allowed by Blink's navigation checks. | 3866 // but still allowed by Blink's navigation checks. |
| 3956 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, UpdateSubframeOpener) { | 3867 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, UpdateSubframeOpener) { |
| 3957 GURL main_url = embedded_test_server()->GetURL( | 3868 GURL main_url = embedded_test_server()->GetURL( |
| 3958 "foo.com", "/frame_tree/page_with_two_frames.html"); | 3869 "foo.com", "/frame_tree/page_with_two_frames.html"); |
| 3959 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3870 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3960 | 3871 |
| 3961 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3872 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3962 ->GetFrameTree() | |
| 3963 ->root(); | |
| 3964 EXPECT_EQ(2U, root->child_count()); | 3873 EXPECT_EQ(2U, root->child_count()); |
| 3965 | 3874 |
| 3966 // From the top frame, open a popup and navigate it to a cross-site page with | 3875 // From the top frame, open a popup and navigate it to a cross-site page with |
| 3967 // two subframes. | 3876 // two subframes. |
| 3968 Shell* popup_shell = | 3877 Shell* popup_shell = |
| 3969 OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "popup"); | 3878 OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "popup"); |
| 3970 EXPECT_TRUE(popup_shell); | 3879 EXPECT_TRUE(popup_shell); |
| 3971 GURL popup_url(embedded_test_server()->GetURL( | 3880 GURL popup_url(embedded_test_server()->GetURL( |
| 3972 "bar.com", "/frame_tree/page_with_post_message_frames.html")); | 3881 "bar.com", "/frame_tree/page_with_post_message_frames.html")); |
| 3973 NavigateToURL(popup_shell, popup_url); | 3882 NavigateToURL(popup_shell, popup_url); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4026 | 3935 |
| 4027 // Check that when a subframe navigates to a new SiteInstance, the new | 3936 // Check that when a subframe navigates to a new SiteInstance, the new |
| 4028 // SiteInstance will get a proxy for the opener of subframe's parent. I.e., | 3937 // SiteInstance will get a proxy for the opener of subframe's parent. I.e., |
| 4029 // accessing parent.opener from the subframe should still work after a | 3938 // accessing parent.opener from the subframe should still work after a |
| 4030 // cross-process navigation. | 3939 // cross-process navigation. |
| 4031 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3940 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4032 NavigatingSubframePreservesOpenerInParent) { | 3941 NavigatingSubframePreservesOpenerInParent) { |
| 4033 GURL main_url = embedded_test_server()->GetURL("a.com", "/post_message.html"); | 3942 GURL main_url = embedded_test_server()->GetURL("a.com", "/post_message.html"); |
| 4034 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3943 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4035 | 3944 |
| 4036 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3945 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4037 ->GetFrameTree() | |
| 4038 ->root(); | |
| 4039 | 3946 |
| 4040 // Open a popup with a cross-site page that has a subframe. | 3947 // Open a popup with a cross-site page that has a subframe. |
| 4041 GURL popup_url(embedded_test_server()->GetURL( | 3948 GURL popup_url(embedded_test_server()->GetURL( |
| 4042 "b.com", "/cross_site_iframe_factory.html?b(b)")); | 3949 "b.com", "/cross_site_iframe_factory.html?b(b)")); |
| 4043 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); | 3950 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); |
| 4044 EXPECT_TRUE(popup_shell); | 3951 EXPECT_TRUE(popup_shell); |
| 4045 FrameTreeNode* popup_root = | 3952 FrameTreeNode* popup_root = |
| 4046 static_cast<WebContentsImpl*>(popup_shell->web_contents()) | 3953 static_cast<WebContentsImpl*>(popup_shell->web_contents()) |
| 4047 ->GetFrameTree() | 3954 ->GetFrameTree() |
| 4048 ->root(); | 3955 ->root(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4073 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 3980 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 4074 } | 3981 } |
| 4075 | 3982 |
| 4076 // Check that if a subframe has an opener, that opener is preserved when the | 3983 // Check that if a subframe has an opener, that opener is preserved when the |
| 4077 // subframe navigates cross-site. | 3984 // subframe navigates cross-site. |
| 4078 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateSubframeWithOpener) { | 3985 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateSubframeWithOpener) { |
| 4079 GURL main_url(embedded_test_server()->GetURL( | 3986 GURL main_url(embedded_test_server()->GetURL( |
| 4080 "foo.com", "/frame_tree/page_with_two_frames.html")); | 3987 "foo.com", "/frame_tree/page_with_two_frames.html")); |
| 4081 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3988 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4082 | 3989 |
| 4083 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3990 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4084 ->GetFrameTree() | |
| 4085 ->root(); | |
| 4086 EXPECT_EQ( | 3991 EXPECT_EQ( |
| 4087 " Site A ------------ proxies for B\n" | 3992 " Site A ------------ proxies for B\n" |
| 4088 " |--Site B ------- proxies for A\n" | 3993 " |--Site B ------- proxies for A\n" |
| 4089 " +--Site A ------- proxies for B\n" | 3994 " +--Site A ------- proxies for B\n" |
| 4090 "Where A = http://foo.com/\n" | 3995 "Where A = http://foo.com/\n" |
| 4091 " B = http://bar.com/", | 3996 " B = http://bar.com/", |
| 4092 DepictFrameTree(root)); | 3997 DepictFrameTree(root)); |
| 4093 | 3998 |
| 4094 // Update the first (cross-site) subframe's opener to root frame. | 3999 // Update the first (cross-site) subframe's opener to root frame. |
| 4095 bool success = false; | 4000 bool success = false; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4140 // RenderFrameProxy is created for that subframe in another renderer process. | 4045 // RenderFrameProxy is created for that subframe in another renderer process. |
| 4141 // Similar to NavigateSubframeWithOpener, but this test verifies the subframe | 4046 // Similar to NavigateSubframeWithOpener, but this test verifies the subframe |
| 4142 // opener plumbing for FrameMsg_NewFrameProxy, whereas | 4047 // opener plumbing for FrameMsg_NewFrameProxy, whereas |
| 4143 // NavigateSubframeWithOpener targets FrameMsg_NewFrame. | 4048 // NavigateSubframeWithOpener targets FrameMsg_NewFrame. |
| 4144 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4049 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4145 NewRenderFrameProxyPreservesOpener) { | 4050 NewRenderFrameProxyPreservesOpener) { |
| 4146 GURL main_url( | 4051 GURL main_url( |
| 4147 embedded_test_server()->GetURL("foo.com", "/post_message.html")); | 4052 embedded_test_server()->GetURL("foo.com", "/post_message.html")); |
| 4148 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4053 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4149 | 4054 |
| 4150 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4055 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4151 ->GetFrameTree() | |
| 4152 ->root(); | |
| 4153 | 4056 |
| 4154 // Open a popup with a cross-site page that has two subframes. | 4057 // Open a popup with a cross-site page that has two subframes. |
| 4155 GURL popup_url(embedded_test_server()->GetURL( | 4058 GURL popup_url(embedded_test_server()->GetURL( |
| 4156 "bar.com", "/frame_tree/page_with_post_message_frames.html")); | 4059 "bar.com", "/frame_tree/page_with_post_message_frames.html")); |
| 4157 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); | 4060 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); |
| 4158 EXPECT_TRUE(popup_shell); | 4061 EXPECT_TRUE(popup_shell); |
| 4159 FrameTreeNode* popup_root = | 4062 FrameTreeNode* popup_root = |
| 4160 static_cast<WebContentsImpl*>(popup_shell->web_contents()) | 4063 static_cast<WebContentsImpl*>(popup_shell->web_contents()) |
| 4161 ->GetFrameTree() | 4064 ->GetFrameTree() |
| 4162 ->root(); | 4065 ->root(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4219 | 4122 |
| 4220 // Test for https://crbug.com/515302. Perform two navigations, A->B->A, and | 4123 // Test for https://crbug.com/515302. Perform two navigations, A->B->A, and |
| 4221 // delay the SwapOut ACK from the A->B navigation, so that the second B->A | 4124 // delay the SwapOut ACK from the A->B navigation, so that the second B->A |
| 4222 // navigation is initiated before the first page receives the SwapOut ACK. | 4125 // navigation is initiated before the first page receives the SwapOut ACK. |
| 4223 // Ensure that the RVH(A) that's pending deletion is not reused in that case. | 4126 // Ensure that the RVH(A) that's pending deletion is not reused in that case. |
| 4224 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4127 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4225 RenderViewHostPendingDeletionIsNotReused) { | 4128 RenderViewHostPendingDeletionIsNotReused) { |
| 4226 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 4129 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 4227 NavigateToURL(shell(), a_url); | 4130 NavigateToURL(shell(), a_url); |
| 4228 | 4131 |
| 4229 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4132 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4230 ->GetFrameTree() | |
| 4231 ->root(); | |
| 4232 RenderFrameHostImpl* rfh = root->current_frame_host(); | 4133 RenderFrameHostImpl* rfh = root->current_frame_host(); |
| 4233 RenderViewHostImpl* rvh = rfh->render_view_host(); | 4134 RenderViewHostImpl* rvh = rfh->render_view_host(); |
| 4234 int rvh_routing_id = rvh->GetRoutingID(); | 4135 int rvh_routing_id = rvh->GetRoutingID(); |
| 4235 SiteInstanceImpl* site_instance = rfh->GetSiteInstance(); | 4136 SiteInstanceImpl* site_instance = rfh->GetSiteInstance(); |
| 4236 RenderFrameDeletedObserver deleted_observer(rfh); | 4137 RenderFrameDeletedObserver deleted_observer(rfh); |
| 4237 | 4138 |
| 4238 // Install a BrowserMessageFilter to drop SwapOut ACK messages in A's | 4139 // Install a BrowserMessageFilter to drop SwapOut ACK messages in A's |
| 4239 // process. | 4140 // process. |
| 4240 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter(); | 4141 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter(); |
| 4241 rfh->GetProcess()->AddFilter(filter.get()); | 4142 rfh->GetProcess()->AddFilter(filter.get()); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4313 // Check that when a cross-process frame acquires focus, the old focused frame | 4214 // Check that when a cross-process frame acquires focus, the old focused frame |
| 4314 // loses focus and fires blur events. Starting on a page with a cross-site | 4215 // loses focus and fires blur events. Starting on a page with a cross-site |
| 4315 // subframe, simulate mouse clicks to switch focus from root frame to subframe | 4216 // subframe, simulate mouse clicks to switch focus from root frame to subframe |
| 4316 // and then back to root frame. | 4217 // and then back to root frame. |
| 4317 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4218 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4318 CrossProcessFocusChangeFiresBlurEvents) { | 4219 CrossProcessFocusChangeFiresBlurEvents) { |
| 4319 GURL main_url( | 4220 GURL main_url( |
| 4320 embedded_test_server()->GetURL("a.com", "/page_with_input_field.html")); | 4221 embedded_test_server()->GetURL("a.com", "/page_with_input_field.html")); |
| 4321 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4222 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4322 | 4223 |
| 4323 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4224 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4324 ->GetFrameTree() | |
| 4325 ->root(); | |
| 4326 | 4225 |
| 4327 EXPECT_EQ( | 4226 EXPECT_EQ( |
| 4328 " Site A ------------ proxies for B\n" | 4227 " Site A ------------ proxies for B\n" |
| 4329 " +--Site B ------- proxies for A\n" | 4228 " +--Site B ------- proxies for A\n" |
| 4330 "Where A = http://a.com/\n" | 4229 "Where A = http://a.com/\n" |
| 4331 " B = http://b.com/", | 4230 " B = http://b.com/", |
| 4332 DepictFrameTree(root)); | 4231 DepictFrameTree(root)); |
| 4333 | 4232 |
| 4334 // Focus the main frame's text field. The return value "input-focus" | 4233 // Focus the main frame's text field. The return value "input-focus" |
| 4335 // indicates that the focus event was fired correctly. | 4234 // indicates that the focus event was fired correctly. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4375 | 4274 |
| 4376 // Check that when a cross-process subframe is focused, its parent's | 4275 // Check that when a cross-process subframe is focused, its parent's |
| 4377 // document.activeElement correctly returns the corresponding <iframe> element. | 4276 // document.activeElement correctly returns the corresponding <iframe> element. |
| 4378 // The test sets up an A-embed-B-embed-C page and shifts focus A->B->A->C, | 4277 // The test sets up an A-embed-B-embed-C page and shifts focus A->B->A->C, |
| 4379 // checking document.activeElement after each change. | 4278 // checking document.activeElement after each change. |
| 4380 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DocumentActiveElement) { | 4279 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DocumentActiveElement) { |
| 4381 GURL main_url(embedded_test_server()->GetURL( | 4280 GURL main_url(embedded_test_server()->GetURL( |
| 4382 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); | 4281 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); |
| 4383 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4282 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4384 | 4283 |
| 4385 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4284 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4386 ->GetFrameTree() | |
| 4387 ->root(); | |
| 4388 | 4285 |
| 4389 EXPECT_EQ( | 4286 EXPECT_EQ( |
| 4390 " Site A ------------ proxies for B C\n" | 4287 " Site A ------------ proxies for B C\n" |
| 4391 " +--Site B ------- proxies for A C\n" | 4288 " +--Site B ------- proxies for A C\n" |
| 4392 " +--Site C -- proxies for A B\n" | 4289 " +--Site C -- proxies for A B\n" |
| 4393 "Where A = http://a.com/\n" | 4290 "Where A = http://a.com/\n" |
| 4394 " B = http://b.com/\n" | 4291 " B = http://b.com/\n" |
| 4395 " C = http://c.com/", | 4292 " C = http://c.com/", |
| 4396 DepictFrameTree(root)); | 4293 DepictFrameTree(root)); |
| 4397 | 4294 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4449 verify_active_element_property(child_rfh, "src", | 4346 verify_active_element_property(child_rfh, "src", |
| 4450 grandchild->current_url().spec()); | 4347 grandchild->current_url().spec()); |
| 4451 } | 4348 } |
| 4452 | 4349 |
| 4453 // Check that window.focus works for cross-process subframes. | 4350 // Check that window.focus works for cross-process subframes. |
| 4454 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframeWindowFocus) { | 4351 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframeWindowFocus) { |
| 4455 GURL main_url(embedded_test_server()->GetURL( | 4352 GURL main_url(embedded_test_server()->GetURL( |
| 4456 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); | 4353 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); |
| 4457 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4354 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4458 | 4355 |
| 4459 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4356 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4460 ->GetFrameTree() | |
| 4461 ->root(); | |
| 4462 | 4357 |
| 4463 EXPECT_EQ( | 4358 EXPECT_EQ( |
| 4464 " Site A ------------ proxies for B C\n" | 4359 " Site A ------------ proxies for B C\n" |
| 4465 " |--Site B ------- proxies for A C\n" | 4360 " |--Site B ------- proxies for A C\n" |
| 4466 " +--Site C ------- proxies for A B\n" | 4361 " +--Site C ------- proxies for A B\n" |
| 4467 "Where A = http://a.com/\n" | 4362 "Where A = http://a.com/\n" |
| 4468 " B = http://b.com/\n" | 4363 " B = http://b.com/\n" |
| 4469 " C = http://c.com/", | 4364 " C = http://c.com/", |
| 4470 DepictFrameTree(root)); | 4365 DepictFrameTree(root)); |
| 4471 | 4366 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4588 | 4483 |
| 4589 // Verify that we receive a mouse cursor update message when we mouse over | 4484 // Verify that we receive a mouse cursor update message when we mouse over |
| 4590 // a text field contained in an out-of-process iframe. | 4485 // a text field contained in an out-of-process iframe. |
| 4591 // Fails under TSan. http://crbug.com/545237 | 4486 // Fails under TSan. http://crbug.com/545237 |
| 4592 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4487 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4593 DISABLED_CursorUpdateFromReceivedFromCrossSiteIframe) { | 4488 DISABLED_CursorUpdateFromReceivedFromCrossSiteIframe) { |
| 4594 GURL main_url(embedded_test_server()->GetURL( | 4489 GURL main_url(embedded_test_server()->GetURL( |
| 4595 "/frame_tree/page_with_positioned_frame.html")); | 4490 "/frame_tree/page_with_positioned_frame.html")); |
| 4596 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4491 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4597 | 4492 |
| 4598 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4493 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4599 ->GetFrameTree() | |
| 4600 ->root(); | |
| 4601 | 4494 |
| 4602 FrameTreeNode* child_node = root->child_at(0); | 4495 FrameTreeNode* child_node = root->child_at(0); |
| 4603 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 4496 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 4604 child_node->current_frame_host()->GetSiteInstance()); | 4497 child_node->current_frame_host()->GetSiteInstance()); |
| 4605 | 4498 |
| 4606 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); | 4499 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); |
| 4607 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 4500 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 4608 | 4501 |
| 4609 // Send a MouseMove to the subframe. The frame contains text, and moving the | 4502 // Send a MouseMove to the subframe. The frame contains text, and moving the |
| 4610 // mouse over it should cause the renderer to send a mouse cursor update. | 4503 // mouse over it should cause the renderer to send a mouse cursor update. |
| 4611 blink::WebMouseEvent mouse_event; | 4504 blink::WebMouseEvent mouse_event; |
| 4612 mouse_event.type = blink::WebInputEvent::MouseMove; | 4505 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 4613 mouse_event.x = 60; | 4506 mouse_event.x = 60; |
| 4614 mouse_event.y = 60; | 4507 mouse_event.y = 60; |
| 4615 RenderWidgetHost* rwh_child = | 4508 RenderWidgetHost* rwh_child = |
| 4616 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 4509 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 4617 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 4510 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 4618 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4511 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 4619 static_cast<WebContentsImpl*>(shell()->web_contents()) | 4512 web_contents()->GetInputEventRouter()->RouteMouseEvent(root_view, |
| 4620 ->GetInputEventRouter() | 4513 &mouse_event); |
| 4621 ->RouteMouseEvent(root_view, &mouse_event); | |
| 4622 | 4514 |
| 4623 // CursorMessageFilter::Wait() implicitly tests whether we receive a | 4515 // CursorMessageFilter::Wait() implicitly tests whether we receive a |
| 4624 // ViewHostMsg_SetCursor message from the renderer process, because it does | 4516 // ViewHostMsg_SetCursor message from the renderer process, because it does |
| 4625 // does not return otherwise. | 4517 // does not return otherwise. |
| 4626 filter->Wait(); | 4518 filter->Wait(); |
| 4627 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); | 4519 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); |
| 4628 } | 4520 } |
| 4629 #endif | 4521 #endif |
| 4630 | 4522 |
| 4631 // Tests that we are using the correct RenderFrameProxy when navigating an | 4523 // Tests that we are using the correct RenderFrameProxy when navigating an |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4654 #if defined(USE_AURA) | 4546 #if defined(USE_AURA) |
| 4655 // Browser process hit testing is not implemented on Android, and this test | 4547 // Browser process hit testing is not implemented on Android, and this test |
| 4656 // requires Aura for RenderWidgetHostViewAura::OnTouchEvent(). | 4548 // requires Aura for RenderWidgetHostViewAura::OnTouchEvent(). |
| 4657 // https://crbug.com/491334 | 4549 // https://crbug.com/491334 |
| 4658 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4550 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4659 SubframeTouchEventRouting) { | 4551 SubframeTouchEventRouting) { |
| 4660 GURL main_url(embedded_test_server()->GetURL( | 4552 GURL main_url(embedded_test_server()->GetURL( |
| 4661 "/frame_tree/page_with_positioned_nested_frames.html")); | 4553 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 4662 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4554 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4663 | 4555 |
| 4664 WebContentsImpl* web_contents = | 4556 WebContentsImpl* contents = web_contents(); |
| 4665 static_cast<WebContentsImpl*>(shell()->web_contents()); | 4557 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 4666 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4667 ASSERT_EQ(1U, root->child_count()); | 4558 ASSERT_EQ(1U, root->child_count()); |
| 4668 | 4559 |
| 4669 GURL frame_url( | 4560 GURL frame_url( |
| 4670 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html")); | 4561 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html")); |
| 4671 NavigateFrameToURL(root->child_at(0), frame_url); | 4562 NavigateFrameToURL(root->child_at(0), frame_url); |
| 4672 | 4563 |
| 4673 // Synchronize with the child and parent renderers to guarantee that the | 4564 // Synchronize with the child and parent renderers to guarantee that the |
| 4674 // surface information required for event hit testing is ready. | 4565 // surface information required for event hit testing is ready. |
| 4675 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( | 4566 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( |
| 4676 root->child_at(0)->current_frame_host()->GetView()); | 4567 root->child_at(0)->current_frame_host()->GetView()); |
| 4677 SurfaceHitTestReadyNotifier notifier( | 4568 SurfaceHitTestReadyNotifier notifier( |
| 4678 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); | 4569 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); |
| 4679 notifier.WaitForSurfaceReady(); | 4570 notifier.WaitForSurfaceReady(); |
| 4680 | 4571 |
| 4681 // Simulate touch event to sub-frame. | 4572 // Simulate touch event to sub-frame. |
| 4682 gfx::Point child_center(150, 150); | 4573 gfx::Point child_center(150, 150); |
| 4683 auto rwhv = static_cast<RenderWidgetHostViewAura*>( | 4574 auto rwhv = static_cast<RenderWidgetHostViewAura*>( |
| 4684 web_contents->GetRenderWidgetHostView()); | 4575 contents->GetRenderWidgetHostView()); |
| 4685 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, | 4576 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, |
| 4686 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); | 4577 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); |
| 4687 rwhv->OnTouchEvent(&touch_event); | 4578 rwhv->OnTouchEvent(&touch_event); |
| 4688 | 4579 |
| 4689 // Verify touch handler in subframe was invoked | 4580 // Verify touch handler in subframe was invoked |
| 4690 std::string result; | 4581 std::string result; |
| 4691 EXPECT_TRUE(ExecuteScriptAndExtractString( | 4582 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 4692 root->child_at(0)->current_frame_host(), | 4583 root->child_at(0)->current_frame_host(), |
| 4693 "window.domAutomationController.send(getLastTouchEvent());", &result)); | 4584 "window.domAutomationController.send(getLastTouchEvent());", &result)); |
| 4694 EXPECT_EQ("touchstart", result); | 4585 EXPECT_EQ("touchstart", result); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4710 #define MAYBE_SubframeGestureEventRouting DISABLED_SubframeGestureEventRouting | 4601 #define MAYBE_SubframeGestureEventRouting DISABLED_SubframeGestureEventRouting |
| 4711 #else | 4602 #else |
| 4712 #define MAYBE_SubframeGestureEventRouting SubframeGestureEventRouting | 4603 #define MAYBE_SubframeGestureEventRouting SubframeGestureEventRouting |
| 4713 #endif | 4604 #endif |
| 4714 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4605 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4715 MAYBE_SubframeGestureEventRouting) { | 4606 MAYBE_SubframeGestureEventRouting) { |
| 4716 GURL main_url(embedded_test_server()->GetURL( | 4607 GURL main_url(embedded_test_server()->GetURL( |
| 4717 "/frame_tree/page_with_positioned_nested_frames.html")); | 4608 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 4718 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4609 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4719 | 4610 |
| 4720 WebContentsImpl* web_contents = | 4611 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4721 static_cast<WebContentsImpl*>(shell()->web_contents()); | |
| 4722 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4723 ASSERT_EQ(1U, root->child_count()); | 4612 ASSERT_EQ(1U, root->child_count()); |
| 4724 | 4613 |
| 4725 GURL frame_url( | 4614 GURL frame_url( |
| 4726 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); | 4615 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); |
| 4727 NavigateFrameToURL(root->child_at(0), frame_url); | 4616 NavigateFrameToURL(root->child_at(0), frame_url); |
| 4728 auto child_frame_host = root->child_at(0)->current_frame_host(); | 4617 auto child_frame_host = root->child_at(0)->current_frame_host(); |
| 4729 | 4618 |
| 4730 // Synchronize with the child and parent renderers to guarantee that the | 4619 // Synchronize with the child and parent renderers to guarantee that the |
| 4731 // surface information required for event hit testing is ready. | 4620 // surface information required for event hit testing is ready. |
| 4732 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( | 4621 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4845 } | 4734 } |
| 4846 | 4735 |
| 4847 } // namespace anonymous | 4736 } // namespace anonymous |
| 4848 | 4737 |
| 4849 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4738 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4850 InputEventRouterGestureTargetQueueTest) { | 4739 InputEventRouterGestureTargetQueueTest) { |
| 4851 GURL main_url(embedded_test_server()->GetURL( | 4740 GURL main_url(embedded_test_server()->GetURL( |
| 4852 "/frame_tree/page_with_positioned_nested_frames.html")); | 4741 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 4853 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4742 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4854 | 4743 |
| 4855 WebContentsImpl* web_contents = | 4744 WebContentsImpl* contents = web_contents(); |
| 4856 static_cast<WebContentsImpl*>(shell()->web_contents()); | 4745 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 4857 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4858 ASSERT_EQ(1U, root->child_count()); | 4746 ASSERT_EQ(1U, root->child_count()); |
| 4859 | 4747 |
| 4860 GURL frame_url( | 4748 GURL frame_url( |
| 4861 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); | 4749 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); |
| 4862 NavigateFrameToURL(root->child_at(0), frame_url); | 4750 NavigateFrameToURL(root->child_at(0), frame_url); |
| 4863 auto child_frame_host = root->child_at(0)->current_frame_host(); | 4751 auto child_frame_host = root->child_at(0)->current_frame_host(); |
| 4864 | 4752 |
| 4865 // Synchronize with the child and parent renderers to guarantee that the | 4753 // Synchronize with the child and parent renderers to guarantee that the |
| 4866 // surface information required for event hit testing is ready. | 4754 // surface information required for event hit testing is ready. |
| 4867 auto rwhv_child = | 4755 auto rwhv_child = |
| 4868 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); | 4756 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); |
| 4869 SurfaceHitTestReadyNotifier notifier( | 4757 SurfaceHitTestReadyNotifier notifier( |
| 4870 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 4758 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
| 4871 notifier.WaitForSurfaceReady(); | 4759 notifier.WaitForSurfaceReady(); |
| 4872 | 4760 |
| 4873 // All touches & gestures are sent to the main frame's view, and should be | 4761 // All touches & gestures are sent to the main frame's view, and should be |
| 4874 // routed appropriately from there. | 4762 // routed appropriately from there. |
| 4875 auto rwhv_parent = static_cast<RenderWidgetHostViewBase*>( | 4763 auto rwhv_parent = static_cast<RenderWidgetHostViewBase*>( |
| 4876 web_contents->GetRenderWidgetHostView()); | 4764 contents->GetRenderWidgetHostView()); |
| 4877 | 4765 |
| 4878 RenderWidgetHostInputEventRouter* router = | 4766 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); |
| 4879 web_contents->GetInputEventRouter(); | |
| 4880 EXPECT_TRUE(router->gesture_target_queue_.empty()); | 4767 EXPECT_TRUE(router->gesture_target_queue_.empty()); |
| 4881 EXPECT_EQ(nullptr, router->gesture_target_); | 4768 EXPECT_EQ(nullptr, router->gesture_target_); |
| 4882 | 4769 |
| 4883 // Send touch sequence to main-frame. | 4770 // Send touch sequence to main-frame. |
| 4884 gfx::Point main_frame_point(25, 25); | 4771 gfx::Point main_frame_point(25, 25); |
| 4885 SendTouchTapWithExpectedTarget(rwhv_parent, main_frame_point, | 4772 SendTouchTapWithExpectedTarget(rwhv_parent, main_frame_point, |
| 4886 router->touch_target_, rwhv_parent); | 4773 router->touch_target_, rwhv_parent); |
| 4887 EXPECT_EQ(1LU, router->gesture_target_queue_.size()); | 4774 EXPECT_EQ(1LU, router->gesture_target_queue_.size()); |
| 4888 EXPECT_EQ(nullptr, router->gesture_target_); | 4775 EXPECT_EQ(nullptr, router->gesture_target_); |
| 4889 | 4776 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5132 // on Android. | 5019 // on Android. |
| 5133 #define MAYBE_PopupMenuTest DISABLED_PopupMenuTest | 5020 #define MAYBE_PopupMenuTest DISABLED_PopupMenuTest |
| 5134 #else | 5021 #else |
| 5135 #define MAYBE_PopupMenuTest PopupMenuTest | 5022 #define MAYBE_PopupMenuTest PopupMenuTest |
| 5136 #endif | 5023 #endif |
| 5137 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_PopupMenuTest) { | 5024 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_PopupMenuTest) { |
| 5138 GURL main_url( | 5025 GURL main_url( |
| 5139 embedded_test_server()->GetURL("/cross_site_iframe_factory.html?a(a)")); | 5026 embedded_test_server()->GetURL("/cross_site_iframe_factory.html?a(a)")); |
| 5140 NavigateToURL(shell(), main_url); | 5027 NavigateToURL(shell(), main_url); |
| 5141 | 5028 |
| 5142 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5029 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5143 ->GetFrameTree() | |
| 5144 ->root(); | |
| 5145 | 5030 |
| 5146 #if !defined(OS_MACOSX) | 5031 #if !defined(OS_MACOSX) |
| 5147 // Unused variable on Mac. | 5032 // Unused variable on Mac. |
| 5148 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( | 5033 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( |
| 5149 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5034 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 5150 #endif | 5035 #endif |
| 5151 static_cast<WebContentsImpl*>(shell()->web_contents())->SendScreenRects(); | 5036 web_contents()->SendScreenRects(); |
| 5152 | 5037 |
| 5153 content::TestNavigationObserver navigation_observer(shell()->web_contents()); | 5038 content::TestNavigationObserver navigation_observer(shell()->web_contents()); |
| 5154 FrameTreeNode* child_node = root->child_at(0); | 5039 FrameTreeNode* child_node = root->child_at(0); |
| 5155 GURL site_url(embedded_test_server()->GetURL( | 5040 GURL site_url(embedded_test_server()->GetURL( |
| 5156 "baz.com", "/site_isolation/page-with-select.html")); | 5041 "baz.com", "/site_isolation/page-with-select.html")); |
| 5157 NavigateFrameToURL(child_node, site_url); | 5042 NavigateFrameToURL(child_node, site_url); |
| 5158 navigation_observer.Wait(); | 5043 navigation_observer.Wait(); |
| 5159 | 5044 |
| 5160 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 5045 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 5161 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5046 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5203 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest | 5088 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest |
| 5204 #else | 5089 #else |
| 5205 // Times out frequently. https://crbug.com/599730. | 5090 // Times out frequently. https://crbug.com/599730. |
| 5206 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest | 5091 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest |
| 5207 #endif | 5092 #endif |
| 5208 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_NestedPopupMenuTest) { | 5093 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_NestedPopupMenuTest) { |
| 5209 GURL main_url(embedded_test_server()->GetURL( | 5094 GURL main_url(embedded_test_server()->GetURL( |
| 5210 "/cross_site_iframe_factory.html?a(b(c))")); | 5095 "/cross_site_iframe_factory.html?a(b(c))")); |
| 5211 NavigateToURL(shell(), main_url); | 5096 NavigateToURL(shell(), main_url); |
| 5212 | 5097 |
| 5213 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5098 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5214 ->GetFrameTree() | |
| 5215 ->root(); | |
| 5216 | 5099 |
| 5217 #if !defined(OS_MACOSX) | 5100 #if !defined(OS_MACOSX) |
| 5218 // Undefined variable on Mac. | 5101 // Undefined variable on Mac. |
| 5219 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( | 5102 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( |
| 5220 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5103 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 5221 #endif | 5104 #endif |
| 5222 static_cast<WebContentsImpl*>(shell()->web_contents())->SendScreenRects(); | 5105 web_contents()->SendScreenRects(); |
| 5223 | 5106 |
| 5224 // For clarity, we are labeling the frame tree nodes as: | 5107 // For clarity, we are labeling the frame tree nodes as: |
| 5225 // - root_node | 5108 // - root_node |
| 5226 // \-> b_node (out-of-process from root and c_node) | 5109 // \-> b_node (out-of-process from root and c_node) |
| 5227 // \-> c_node (out-of-process from root and b_node) | 5110 // \-> c_node (out-of-process from root and b_node) |
| 5228 | 5111 |
| 5229 content::TestNavigationObserver navigation_observer(shell()->web_contents()); | 5112 content::TestNavigationObserver navigation_observer(shell()->web_contents()); |
| 5230 FrameTreeNode* b_node = root->child_at(0); | 5113 FrameTreeNode* b_node = root->child_at(0); |
| 5231 FrameTreeNode* c_node = b_node->child_at(0); | 5114 FrameTreeNode* c_node = b_node->child_at(0); |
| 5232 GURL site_url(embedded_test_server()->GetURL( | 5115 GURL site_url(embedded_test_server()->GetURL( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5489 // if a pending cross-process navigation is cancelled. The test works by trying | 5372 // if a pending cross-process navigation is cancelled. The test works by trying |
| 5490 // to create a new RenderFrame with the same routing id. If there is an | 5373 // to create a new RenderFrame with the same routing id. If there is an |
| 5491 // entry with the same routing ID, a CHECK is hit and the process crashes. | 5374 // entry with the same routing ID, a CHECK is hit and the process crashes. |
| 5492 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5375 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5493 SubframePendingAndBackToSameSiteInstance) { | 5376 SubframePendingAndBackToSameSiteInstance) { |
| 5494 GURL main_url(embedded_test_server()->GetURL( | 5377 GURL main_url(embedded_test_server()->GetURL( |
| 5495 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 5378 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 5496 NavigateToURL(shell(), main_url); | 5379 NavigateToURL(shell(), main_url); |
| 5497 | 5380 |
| 5498 // Capture the FrameTreeNode this test will be navigating. | 5381 // Capture the FrameTreeNode this test will be navigating. |
| 5499 FrameTreeNode* node = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5382 FrameTreeNode* node = web_contents()->GetFrameTree()->root()->child_at(0); |
| 5500 ->GetFrameTree() | |
| 5501 ->root() | |
| 5502 ->child_at(0); | |
| 5503 EXPECT_TRUE(node); | 5383 EXPECT_TRUE(node); |
| 5504 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), | 5384 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), |
| 5505 node->parent()->current_frame_host()->GetSiteInstance()); | 5385 node->parent()->current_frame_host()->GetSiteInstance()); |
| 5506 | 5386 |
| 5507 // Navigate to the site of the parent, but to a page that will not commit. | 5387 // Navigate to the site of the parent, but to a page that will not commit. |
| 5508 GURL same_site_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 5388 GURL same_site_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 5509 NavigationStallDelegate stall_delegate(same_site_url); | 5389 NavigationStallDelegate stall_delegate(same_site_url); |
| 5510 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); | 5390 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); |
| 5511 { | 5391 { |
| 5512 NavigationController::LoadURLParams params(same_site_url); | 5392 NavigationController::LoadURLParams params(same_site_url); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5566 | 5446 |
| 5567 // This test ensures that the RenderFrame isn't leaked in the renderer process | 5447 // This test ensures that the RenderFrame isn't leaked in the renderer process |
| 5568 // when a remote parent detaches a child frame. The test works by trying | 5448 // when a remote parent detaches a child frame. The test works by trying |
| 5569 // to create a new RenderFrame with the same routing id. If there is an | 5449 // to create a new RenderFrame with the same routing id. If there is an |
| 5570 // entry with the same routing ID, a CHECK is hit and the process crashes. | 5450 // entry with the same routing ID, a CHECK is hit and the process crashes. |
| 5571 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ParentDetachRemoteChild) { | 5451 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ParentDetachRemoteChild) { |
| 5572 GURL main_url(embedded_test_server()->GetURL( | 5452 GURL main_url(embedded_test_server()->GetURL( |
| 5573 "a.com", "/cross_site_iframe_factory.html?a(b,b)")); | 5453 "a.com", "/cross_site_iframe_factory.html?a(b,b)")); |
| 5574 NavigateToURL(shell(), main_url); | 5454 NavigateToURL(shell(), main_url); |
| 5575 | 5455 |
| 5576 WebContentsImpl* web_contents = | 5456 WebContentsImpl* contents = web_contents(); |
| 5577 static_cast<WebContentsImpl*>(shell()->web_contents()); | 5457 EXPECT_EQ(2U, contents->GetFrameTree()->root()->child_count()); |
| 5578 EXPECT_EQ(2U, web_contents->GetFrameTree()->root()->child_count()); | |
| 5579 | 5458 |
| 5580 // Capture the FrameTreeNode this test will be navigating. | 5459 // Capture the FrameTreeNode this test will be navigating. |
| 5581 FrameTreeNode* node = web_contents->GetFrameTree()->root()->child_at(0); | 5460 FrameTreeNode* node = contents->GetFrameTree()->root()->child_at(0); |
| 5582 EXPECT_TRUE(node); | 5461 EXPECT_TRUE(node); |
| 5583 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), | 5462 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), |
| 5584 node->parent()->current_frame_host()->GetSiteInstance()); | 5463 node->parent()->current_frame_host()->GetSiteInstance()); |
| 5585 | 5464 |
| 5586 // Grab the routing id of the first child RenderFrameHost and set up a process | 5465 // Grab the routing id of the first child RenderFrameHost and set up a process |
| 5587 // observer to ensure there is no crash when a new RenderFrame creation is | 5466 // observer to ensure there is no crash when a new RenderFrame creation is |
| 5588 // attempted. | 5467 // attempted. |
| 5589 RenderProcessHost* process = node->current_frame_host()->GetProcess(); | 5468 RenderProcessHost* process = node->current_frame_host()->GetProcess(); |
| 5590 RenderProcessHostWatcher watcher( | 5469 RenderProcessHostWatcher watcher( |
| 5591 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 5470 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 5592 int frame_routing_id = node->current_frame_host()->GetRoutingID(); | 5471 int frame_routing_id = node->current_frame_host()->GetRoutingID(); |
| 5593 int widget_routing_id = | 5472 int widget_routing_id = |
| 5594 node->current_frame_host()->GetRenderWidgetHost()->GetRoutingID(); | 5473 node->current_frame_host()->GetRenderWidgetHost()->GetRoutingID(); |
| 5595 int parent_routing_id = | 5474 int parent_routing_id = |
| 5596 node->parent()->render_manager()->GetRoutingIdForSiteInstance( | 5475 node->parent()->render_manager()->GetRoutingIdForSiteInstance( |
| 5597 node->current_frame_host()->GetSiteInstance()); | 5476 node->current_frame_host()->GetSiteInstance()); |
| 5598 | 5477 |
| 5599 // Have the parent frame remove the child frame from its DOM. This should | 5478 // Have the parent frame remove the child frame from its DOM. This should |
| 5600 // result in the child RenderFrame being deleted in the remote process. | 5479 // result in the child RenderFrame being deleted in the remote process. |
| 5601 EXPECT_TRUE(ExecuteScript(web_contents, | 5480 EXPECT_TRUE(ExecuteScript(contents, |
| 5602 "document.body.removeChild(" | 5481 "document.body.removeChild(" |
| 5603 "document.querySelectorAll('iframe')[0])")); | 5482 "document.querySelectorAll('iframe')[0])")); |
| 5604 EXPECT_EQ(1U, web_contents->GetFrameTree()->root()->child_count()); | 5483 EXPECT_EQ(1U, contents->GetFrameTree()->root()->child_count()); |
| 5605 | 5484 |
| 5606 { | 5485 { |
| 5607 FrameMsg_NewFrame_Params params; | 5486 FrameMsg_NewFrame_Params params; |
| 5608 params.routing_id = frame_routing_id; | 5487 params.routing_id = frame_routing_id; |
| 5609 params.proxy_routing_id = MSG_ROUTING_NONE; | 5488 params.proxy_routing_id = MSG_ROUTING_NONE; |
| 5610 params.opener_routing_id = MSG_ROUTING_NONE; | 5489 params.opener_routing_id = MSG_ROUTING_NONE; |
| 5611 params.parent_routing_id = parent_routing_id; | 5490 params.parent_routing_id = parent_routing_id; |
| 5612 params.previous_sibling_routing_id = MSG_ROUTING_NONE; | 5491 params.previous_sibling_routing_id = MSG_ROUTING_NONE; |
| 5613 params.widget_params.routing_id = widget_routing_id; | 5492 params.widget_params.routing_id = widget_routing_id; |
| 5614 params.widget_params.hidden = true; | 5493 params.widget_params.hidden = true; |
| 5615 params.replication_state.name = "name"; | 5494 params.replication_state.name = "name"; |
| 5616 params.replication_state.unique_name = "name"; | 5495 params.replication_state.unique_name = "name"; |
| 5617 | 5496 |
| 5618 process->Send(new FrameMsg_NewFrame(params)); | 5497 process->Send(new FrameMsg_NewFrame(params)); |
| 5619 } | 5498 } |
| 5620 | 5499 |
| 5621 // The test must wait for the process to exit, but if there is no leak, the | 5500 // The test must wait for the process to exit, but if there is no leak, the |
| 5622 // RenderFrame will be properly created and there will be no crash. | 5501 // RenderFrame will be properly created and there will be no crash. |
| 5623 // Therefore, navigate the remaining subframe to completely different site, | 5502 // Therefore, navigate the remaining subframe to completely different site, |
| 5624 // which will cause the original process to exit cleanly. | 5503 // which will cause the original process to exit cleanly. |
| 5625 NavigateFrameToURL( | 5504 NavigateFrameToURL(contents->GetFrameTree()->root()->child_at(0), |
| 5626 web_contents->GetFrameTree()->root()->child_at(0), | 5505 embedded_test_server()->GetURL("d.com", "/title3.html")); |
| 5627 embedded_test_server()->GetURL("d.com", "/title3.html")); | |
| 5628 watcher.Wait(); | 5506 watcher.Wait(); |
| 5629 EXPECT_TRUE(watcher.did_exit_normally()); | 5507 EXPECT_TRUE(watcher.did_exit_normally()); |
| 5630 } | 5508 } |
| 5631 | 5509 |
| 5632 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChanged) { | 5510 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChanged) { |
| 5633 GURL main_url( | 5511 GURL main_url( |
| 5634 embedded_test_server()->GetURL("a.com", "/page_with_iframe.html")); | 5512 embedded_test_server()->GetURL("a.com", "/page_with_iframe.html")); |
| 5635 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 5513 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5636 EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), main_url); | 5514 EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), main_url); |
| 5637 | 5515 |
| 5638 GURL cross_site_url = | 5516 GURL cross_site_url = |
| 5639 embedded_test_server()->GetURL("oopif.com", "/title1.html"); | 5517 embedded_test_server()->GetURL("oopif.com", "/title1.html"); |
| 5640 | 5518 |
| 5641 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5519 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5642 ->GetFrameTree() | |
| 5643 ->root(); | |
| 5644 | 5520 |
| 5645 TestNavigationObserver observer(shell()->web_contents()); | 5521 TestNavigationObserver observer(shell()->web_contents()); |
| 5646 | 5522 |
| 5647 NavigateFrameToURL(root->child_at(0), cross_site_url); | 5523 NavigateFrameToURL(root->child_at(0), cross_site_url); |
| 5648 EXPECT_EQ(cross_site_url, observer.last_navigation_url()); | 5524 EXPECT_EQ(cross_site_url, observer.last_navigation_url()); |
| 5649 EXPECT_TRUE(observer.last_navigation_succeeded()); | 5525 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 5650 | 5526 |
| 5651 RenderWidgetHostImpl* render_widget_host = | 5527 RenderWidgetHostImpl* render_widget_host = |
| 5652 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 5528 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 5653 EXPECT_FALSE(render_widget_host->is_hidden()); | 5529 EXPECT_FALSE(render_widget_host->is_hidden()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5671 } | 5547 } |
| 5672 | 5548 |
| 5673 // Verify that sandbox flags inheritance works across multiple levels of | 5549 // Verify that sandbox flags inheritance works across multiple levels of |
| 5674 // frames. See https://crbug.com/576845. | 5550 // frames. See https://crbug.com/576845. |
| 5675 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsInheritance) { | 5551 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsInheritance) { |
| 5676 GURL main_url(embedded_test_server()->GetURL( | 5552 GURL main_url(embedded_test_server()->GetURL( |
| 5677 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5553 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5678 NavigateToURL(shell(), main_url); | 5554 NavigateToURL(shell(), main_url); |
| 5679 | 5555 |
| 5680 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5556 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5681 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5557 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5682 ->GetFrameTree() | |
| 5683 ->root(); | |
| 5684 | 5558 |
| 5685 // Set sandbox flags for child frame. | 5559 // Set sandbox flags for child frame. |
| 5686 EXPECT_TRUE(ExecuteScript( | 5560 EXPECT_TRUE(ExecuteScript( |
| 5687 root->current_frame_host(), | 5561 root->current_frame_host(), |
| 5688 "document.querySelector('iframe').sandbox = 'allow-scripts';")); | 5562 "document.querySelector('iframe').sandbox = 'allow-scripts';")); |
| 5689 | 5563 |
| 5690 // Calculate expected flags. Note that "allow-scripts" resets both | 5564 // Calculate expected flags. Note that "allow-scripts" resets both |
| 5691 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per | 5565 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per |
| 5692 // blink::parseSandboxPolicy(). | 5566 // blink::parseSandboxPolicy(). |
| 5693 blink::WebSandboxFlags expected_flags = | 5567 blink::WebSandboxFlags expected_flags = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5726 // a child frame, update its sandbox flags but don't navigate the frame, and | 5600 // a child frame, update its sandbox flags but don't navigate the frame, and |
| 5727 // ensure that a new cross-site grandchild frame doesn't inherit the new flags | 5601 // ensure that a new cross-site grandchild frame doesn't inherit the new flags |
| 5728 // (which shouldn't have taken effect). | 5602 // (which shouldn't have taken effect). |
| 5729 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5603 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5730 SandboxFlagsNotInheritedBeforeNavigation) { | 5604 SandboxFlagsNotInheritedBeforeNavigation) { |
| 5731 GURL main_url(embedded_test_server()->GetURL( | 5605 GURL main_url(embedded_test_server()->GetURL( |
| 5732 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5606 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5733 NavigateToURL(shell(), main_url); | 5607 NavigateToURL(shell(), main_url); |
| 5734 | 5608 |
| 5735 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5609 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5736 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5610 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5737 ->GetFrameTree() | |
| 5738 ->root(); | |
| 5739 | 5611 |
| 5740 // Set sandbox flags for child frame. | 5612 // Set sandbox flags for child frame. |
| 5741 EXPECT_TRUE(ExecuteScript( | 5613 EXPECT_TRUE(ExecuteScript( |
| 5742 root->current_frame_host(), | 5614 root->current_frame_host(), |
| 5743 "document.querySelector('iframe').sandbox = 'allow-scripts';")); | 5615 "document.querySelector('iframe').sandbox = 'allow-scripts';")); |
| 5744 | 5616 |
| 5745 // These flags should be pending but not take effect, since there's been no | 5617 // These flags should be pending but not take effect, since there's been no |
| 5746 // navigation. | 5618 // navigation. |
| 5747 blink::WebSandboxFlags expected_flags = | 5619 blink::WebSandboxFlags expected_flags = |
| 5748 blink::WebSandboxFlags::All & ~blink::WebSandboxFlags::Scripts & | 5620 blink::WebSandboxFlags::All & ~blink::WebSandboxFlags::Scripts & |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5778 // Verify that popups opened from sandboxed frames inherit sandbox flags from | 5650 // Verify that popups opened from sandboxed frames inherit sandbox flags from |
| 5779 // their opener, and that they keep these inherited flags after being navigated | 5651 // their opener, and that they keep these inherited flags after being navigated |
| 5780 // cross-site. See https://crbug.com/483584. | 5652 // cross-site. See https://crbug.com/483584. |
| 5781 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5653 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5782 NewPopupInheritsSandboxFlagsFromOpener) { | 5654 NewPopupInheritsSandboxFlagsFromOpener) { |
| 5783 GURL main_url(embedded_test_server()->GetURL( | 5655 GURL main_url(embedded_test_server()->GetURL( |
| 5784 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5656 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5785 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 5657 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5786 | 5658 |
| 5787 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5659 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5788 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5660 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5789 ->GetFrameTree() | |
| 5790 ->root(); | |
| 5791 | 5661 |
| 5792 // Set sandbox flags for child frame. | 5662 // Set sandbox flags for child frame. |
| 5793 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), | 5663 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), |
| 5794 "document.querySelector('iframe').sandbox = " | 5664 "document.querySelector('iframe').sandbox = " |
| 5795 " 'allow-scripts allow-popups';")); | 5665 " 'allow-scripts allow-popups';")); |
| 5796 | 5666 |
| 5797 // Calculate expected flags. Note that "allow-scripts" resets both | 5667 // Calculate expected flags. Note that "allow-scripts" resets both |
| 5798 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per | 5668 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per |
| 5799 // blink::parseSandboxPolicy(). | 5669 // blink::parseSandboxPolicy(). |
| 5800 blink::WebSandboxFlags expected_flags = | 5670 blink::WebSandboxFlags expected_flags = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5849 // Verify that popups opened from frames sandboxed with the | 5719 // Verify that popups opened from frames sandboxed with the |
| 5850 // "allow-popups-to-escape-sandbox" directive do *not* inherit sandbox flags | 5720 // "allow-popups-to-escape-sandbox" directive do *not* inherit sandbox flags |
| 5851 // from their opener. | 5721 // from their opener. |
| 5852 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5722 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5853 OpenUnsandboxedPopupFromSandboxedFrame) { | 5723 OpenUnsandboxedPopupFromSandboxedFrame) { |
| 5854 GURL main_url(embedded_test_server()->GetURL( | 5724 GURL main_url(embedded_test_server()->GetURL( |
| 5855 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5725 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5856 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 5726 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5857 | 5727 |
| 5858 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5728 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5859 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5729 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5860 ->GetFrameTree() | |
| 5861 ->root(); | |
| 5862 | 5730 |
| 5863 // Set sandbox flags for child frame, specifying that popups opened from it | 5731 // Set sandbox flags for child frame, specifying that popups opened from it |
| 5864 // should not be sandboxed. | 5732 // should not be sandboxed. |
| 5865 EXPECT_TRUE(ExecuteScript( | 5733 EXPECT_TRUE(ExecuteScript( |
| 5866 root->current_frame_host(), | 5734 root->current_frame_host(), |
| 5867 "document.querySelector('iframe').sandbox = " | 5735 "document.querySelector('iframe').sandbox = " |
| 5868 " 'allow-scripts allow-popups allow-popups-to-escape-sandbox';")); | 5736 " 'allow-scripts allow-popups allow-popups-to-escape-sandbox';")); |
| 5869 | 5737 |
| 5870 // Set expected flags for the child frame. Note that "allow-scripts" resets | 5738 // Set expected flags for the child frame. Note that "allow-scripts" resets |
| 5871 // both WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits | 5739 // both WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5926 SetupCrossSiteRedirector(&https_server); | 5794 SetupCrossSiteRedirector(&https_server); |
| 5927 | 5795 |
| 5928 GURL iframe_url( | 5796 GURL iframe_url( |
| 5929 https_server.GetURL("/mixed-content/basic-passive-in-iframe.html")); | 5797 https_server.GetURL("/mixed-content/basic-passive-in-iframe.html")); |
| 5930 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); | 5798 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); |
| 5931 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); | 5799 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5932 | 5800 |
| 5933 // When the subframe navigates, the WebContents should still be marked | 5801 // When the subframe navigates, the WebContents should still be marked |
| 5934 // as having displayed insecure content. | 5802 // as having displayed insecure content. |
| 5935 GURL navigate_url(https_server.GetURL("/title1.html")); | 5803 GURL navigate_url(https_server.GetURL("/title1.html")); |
| 5936 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5804 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5937 ->GetFrameTree() | |
| 5938 ->root(); | |
| 5939 NavigateFrameToURL(root->child_at(0), navigate_url); | 5805 NavigateFrameToURL(root->child_at(0), navigate_url); |
| 5940 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); | 5806 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5941 | 5807 |
| 5942 // When the main frame navigates, it should no longer be marked as | 5808 // When the main frame navigates, it should no longer be marked as |
| 5943 // displaying insecure content. | 5809 // displaying insecure content. |
| 5944 EXPECT_TRUE( | 5810 EXPECT_TRUE( |
| 5945 NavigateToURL(shell(), https_server.GetURL("b.com", "/title1.html"))); | 5811 NavigateToURL(shell(), https_server.GetURL("b.com", "/title1.html"))); |
| 5946 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); | 5812 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5947 } | 5813 } |
| 5948 | 5814 |
| 5949 // Tests that, when a parent frame is set to strictly block mixed | 5815 // Tests that, when a parent frame is set to strictly block mixed |
| 5950 // content via Content Security Policy, child OOPIFs cannot display | 5816 // content via Content Security Policy, child OOPIFs cannot display |
| 5951 // mixed content. | 5817 // mixed content. |
| 5952 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, | 5818 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
| 5953 PassiveMixedContentInIframeWithStrictBlocking) { | 5819 PassiveMixedContentInIframeWithStrictBlocking) { |
| 5954 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 5820 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 5955 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 5821 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| 5956 ASSERT_TRUE(https_server.Start()); | 5822 ASSERT_TRUE(https_server.Start()); |
| 5957 SetupCrossSiteRedirector(&https_server); | 5823 SetupCrossSiteRedirector(&https_server); |
| 5958 | 5824 |
| 5959 GURL iframe_url_with_strict_blocking(https_server.GetURL( | 5825 GURL iframe_url_with_strict_blocking(https_server.GetURL( |
| 5960 "/mixed-content/basic-passive-in-iframe-with-strict-blocking.html")); | 5826 "/mixed-content/basic-passive-in-iframe-with-strict-blocking.html")); |
| 5961 EXPECT_TRUE(NavigateToURL(shell(), iframe_url_with_strict_blocking)); | 5827 EXPECT_TRUE(NavigateToURL(shell(), iframe_url_with_strict_blocking)); |
| 5962 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); | 5828 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5963 | 5829 |
| 5964 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5830 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5965 ->GetFrameTree() | |
| 5966 ->root(); | |
| 5967 EXPECT_TRUE(root->current_replication_state() | 5831 EXPECT_TRUE(root->current_replication_state() |
| 5968 .should_enforce_strict_mixed_content_checking); | 5832 .should_enforce_strict_mixed_content_checking); |
| 5969 EXPECT_TRUE(root->child_at(0) | 5833 EXPECT_TRUE(root->child_at(0) |
| 5970 ->current_replication_state() | 5834 ->current_replication_state() |
| 5971 .should_enforce_strict_mixed_content_checking); | 5835 .should_enforce_strict_mixed_content_checking); |
| 5972 | 5836 |
| 5973 // When the subframe navigates, it should still be marked as enforcing | 5837 // When the subframe navigates, it should still be marked as enforcing |
| 5974 // strict mixed content. | 5838 // strict mixed content. |
| 5975 GURL navigate_url(https_server.GetURL("/title1.html")); | 5839 GURL navigate_url(https_server.GetURL("/title1.html")); |
| 5976 NavigateFrameToURL(root->child_at(0), navigate_url); | 5840 NavigateFrameToURL(root->child_at(0), navigate_url); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5995 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, | 5859 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
| 5996 ActiveMixedContentInIframe) { | 5860 ActiveMixedContentInIframe) { |
| 5997 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 5861 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 5998 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 5862 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| 5999 ASSERT_TRUE(https_server.Start()); | 5863 ASSERT_TRUE(https_server.Start()); |
| 6000 SetupCrossSiteRedirector(&https_server); | 5864 SetupCrossSiteRedirector(&https_server); |
| 6001 | 5865 |
| 6002 GURL iframe_url( | 5866 GURL iframe_url( |
| 6003 https_server.GetURL("/mixed-content/basic-active-in-iframe.html")); | 5867 https_server.GetURL("/mixed-content/basic-active-in-iframe.html")); |
| 6004 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); | 5868 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); |
| 6005 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5869 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6006 ->GetFrameTree() | |
| 6007 ->root(); | |
| 6008 ASSERT_EQ(1U, root->child_count()); | 5870 ASSERT_EQ(1U, root->child_count()); |
| 6009 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); | 5871 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); |
| 6010 ASSERT_TRUE(mixed_child); | 5872 ASSERT_TRUE(mixed_child); |
| 6011 // The child iframe attempted to create a mixed iframe; this should | 5873 // The child iframe attempted to create a mixed iframe; this should |
| 6012 // have been blocked, so the mixed iframe should not have committed a | 5874 // have been blocked, so the mixed iframe should not have committed a |
| 6013 // load. | 5875 // load. |
| 6014 EXPECT_FALSE(mixed_child->has_committed_real_load()); | 5876 EXPECT_FALSE(mixed_child->has_committed_real_load()); |
| 6015 } | 5877 } |
| 6016 | 5878 |
| 6017 // Test setting a cross-origin iframe to display: none. | 5879 // Test setting a cross-origin iframe to display: none. |
| 6018 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframeDisplayNone) { | 5880 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframeDisplayNone) { |
| 6019 GURL main_url(embedded_test_server()->GetURL( | 5881 GURL main_url(embedded_test_server()->GetURL( |
| 6020 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 5882 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 6021 NavigateToURL(shell(), main_url); | 5883 NavigateToURL(shell(), main_url); |
| 6022 | 5884 |
| 6023 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5885 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6024 ->GetFrameTree() | |
| 6025 ->root(); | |
| 6026 RenderWidgetHost* root_render_widget_host = | 5886 RenderWidgetHost* root_render_widget_host = |
| 6027 root->current_frame_host()->GetRenderWidgetHost(); | 5887 root->current_frame_host()->GetRenderWidgetHost(); |
| 6028 | 5888 |
| 6029 // Set the iframe to display: none. | 5889 // Set the iframe to display: none. |
| 6030 EXPECT_TRUE( | 5890 EXPECT_TRUE( |
| 6031 ExecuteScript(shell()->web_contents(), | 5891 ExecuteScript(shell()->web_contents(), |
| 6032 "document.querySelector('iframe').style.display = 'none'")); | 5892 "document.querySelector('iframe').style.display = 'none'")); |
| 6033 | 5893 |
| 6034 // Waits until pending frames are done. | 5894 // Waits until pending frames are done. |
| 6035 std::unique_ptr<MainThreadFrameObserver> observer( | 5895 std::unique_ptr<MainThreadFrameObserver> observer( |
| 6036 new MainThreadFrameObserver(root_render_widget_host)); | 5896 new MainThreadFrameObserver(root_render_widget_host)); |
| 6037 observer->Wait(); | 5897 observer->Wait(); |
| 6038 | 5898 |
| 6039 // Force the renderer to generate a new frame. | 5899 // Force the renderer to generate a new frame. |
| 6040 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5900 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
| 6041 "document.body.style.background = 'black'")); | 5901 "document.body.style.background = 'black'")); |
| 6042 | 5902 |
| 6043 // Waits for the next frame. | 5903 // Waits for the next frame. |
| 6044 observer->Wait(); | 5904 observer->Wait(); |
| 6045 } | 5905 } |
| 6046 | 5906 |
| 6047 // Test that a cross-origin iframe can be blocked by X-Frame-Options and CSP | 5907 // Test that a cross-origin iframe can be blocked by X-Frame-Options and CSP |
| 6048 // frame-ancestors. | 5908 // frame-ancestors. |
| 6049 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5909 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 6050 CrossSiteIframeBlockedByXFrameOptionsOrCSP) { | 5910 CrossSiteIframeBlockedByXFrameOptionsOrCSP) { |
| 6051 GURL main_url(embedded_test_server()->GetURL( | 5911 GURL main_url(embedded_test_server()->GetURL( |
| 6052 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5912 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 6053 NavigateToURL(shell(), main_url); | 5913 NavigateToURL(shell(), main_url); |
| 6054 | 5914 |
| 6055 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5915 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6056 ->GetFrameTree() | |
| 6057 ->root(); | |
| 6058 | 5916 |
| 6059 // Add a load event handler for the iframe element. | 5917 // Add a load event handler for the iframe element. |
| 6060 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5918 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
| 6061 "document.querySelector('iframe').onload = " | 5919 "document.querySelector('iframe').onload = " |
| 6062 " function() { document.title = 'loaded'; };")); | 5920 " function() { document.title = 'loaded'; };")); |
| 6063 | 5921 |
| 6064 GURL blocked_urls[] = { | 5922 GURL blocked_urls[] = { |
| 6065 embedded_test_server()->GetURL("b.com", "/frame-ancestors-none.html"), | 5923 embedded_test_server()->GetURL("b.com", "/frame-ancestors-none.html"), |
| 6066 embedded_test_server()->GetURL("b.com", "/x-frame-options-deny.html") | 5924 embedded_test_server()->GetURL("b.com", "/x-frame-options-deny.html") |
| 6067 }; | 5925 }; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6115 EXPECT_EQ(blink::WebSandboxFlags::None, | 5973 EXPECT_EQ(blink::WebSandboxFlags::None, |
| 6116 root->child_at(0)->effective_sandbox_flags()); | 5974 root->child_at(0)->effective_sandbox_flags()); |
| 6117 } | 5975 } |
| 6118 } | 5976 } |
| 6119 | 5977 |
| 6120 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ScreenCoordinates) { | 5978 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ScreenCoordinates) { |
| 6121 GURL main_url(embedded_test_server()->GetURL( | 5979 GURL main_url(embedded_test_server()->GetURL( |
| 6122 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 5980 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 6123 NavigateToURL(shell(), main_url); | 5981 NavigateToURL(shell(), main_url); |
| 6124 | 5982 |
| 6125 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5983 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6126 ->GetFrameTree() | |
| 6127 ->root(); | |
| 6128 FrameTreeNode* child = root->child_at(0); | 5984 FrameTreeNode* child = root->child_at(0); |
| 6129 | 5985 |
| 6130 const char* properties[] = {"screenX", "screenY", "outerWidth", | 5986 const char* properties[] = {"screenX", "screenY", "outerWidth", |
| 6131 "outerHeight"}; | 5987 "outerHeight"}; |
| 6132 | 5988 |
| 6133 for (const char* property : properties) { | 5989 for (const char* property : properties) { |
| 6134 std::string script = "window.domAutomationController.send(window."; | 5990 std::string script = "window.domAutomationController.send(window."; |
| 6135 script += property; | 5991 script += property; |
| 6136 script += ");"; | 5992 script += ");"; |
| 6137 int root_value = 1; | 5993 int root_value = 1; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6201 | 6057 |
| 6202 // Tests that the swapped out state on RenderViewHost is properly reset when | 6058 // Tests that the swapped out state on RenderViewHost is properly reset when |
| 6203 // the main frame is navigated to the same SiteInstance as one of its child | 6059 // the main frame is navigated to the same SiteInstance as one of its child |
| 6204 // frames. | 6060 // frames. |
| 6205 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 6061 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 6206 NavigateMainFrameToChildSite) { | 6062 NavigateMainFrameToChildSite) { |
| 6207 GURL main_url(embedded_test_server()->GetURL( | 6063 GURL main_url(embedded_test_server()->GetURL( |
| 6208 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 6064 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 6209 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 6065 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 6210 | 6066 |
| 6211 WebContentsImpl* contents = | 6067 WebContentsImpl* contents = web_contents(); |
| 6212 static_cast<WebContentsImpl*>(shell()->web_contents()); | |
| 6213 FrameTreeNode* root = contents->GetFrameTree()->root(); | 6068 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 6214 EXPECT_EQ(1U, root->child_count()); | 6069 EXPECT_EQ(1U, root->child_count()); |
| 6215 | 6070 |
| 6216 // Ensure the RenderViewHost for the SiteInstance of the child is considered | 6071 // Ensure the RenderViewHost for the SiteInstance of the child is considered |
| 6217 // in swapped out state. | 6072 // in swapped out state. |
| 6218 RenderViewHostImpl* rvh = contents->GetFrameTree()->GetRenderViewHost( | 6073 RenderViewHostImpl* rvh = contents->GetFrameTree()->GetRenderViewHost( |
| 6219 root->child_at(0)->current_frame_host()->GetSiteInstance()); | 6074 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
| 6220 EXPECT_TRUE(rvh->is_swapped_out_); | 6075 EXPECT_TRUE(rvh->is_swapped_out_); |
| 6221 | 6076 |
| 6222 // Have the child frame navigate its parent to its SiteInstance. | 6077 // Have the child frame navigate its parent to its SiteInstance. |
| 6223 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 6078 GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 6224 std::string script = base::StringPrintf( | 6079 std::string script = base::StringPrintf( |
| 6225 "window.domAutomationController.send(" | 6080 "window.domAutomationController.send(" |
| 6226 "parent.location = '%s');", | 6081 "parent.location = '%s');", |
| 6227 b_url.spec().c_str()); | 6082 b_url.spec().c_str()); |
| 6228 | 6083 |
| 6229 TestFrameNavigationObserver frame_observer(root); | 6084 TestFrameNavigationObserver frame_observer(root); |
| 6230 EXPECT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(), script)); | 6085 EXPECT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(), script)); |
| 6231 frame_observer.Wait(); | 6086 frame_observer.Wait(); |
| 6232 EXPECT_EQ(b_url, root->current_url()); | 6087 EXPECT_EQ(b_url, root->current_url()); |
| 6233 | 6088 |
| 6234 // Verify that the same RenderViewHost is preserved and that it is no longer | 6089 // Verify that the same RenderViewHost is preserved and that it is no longer |
| 6235 // in swapped out state. | 6090 // in swapped out state. |
| 6236 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( | 6091 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
| 6237 root->current_frame_host()->GetSiteInstance())); | 6092 root->current_frame_host()->GetSiteInstance())); |
| 6238 EXPECT_FALSE(rvh->is_swapped_out_); | 6093 EXPECT_FALSE(rvh->is_swapped_out_); |
| 6239 } | 6094 } |
| 6240 | 6095 |
| 6241 } // namespace content | 6096 } // namespace content |
| OLD | NEW |