Chromium Code Reviews| 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 }; | 623 }; |
| 624 | 624 |
| 625 // 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 |
| 626 // correct documents are committed. | 626 // correct documents are committed. |
| 627 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { | 627 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
| 628 GURL main_url(embedded_test_server()->GetURL( | 628 GURL main_url(embedded_test_server()->GetURL( |
| 629 "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)))")); |
| 630 NavigateToURL(shell(), main_url); | 630 NavigateToURL(shell(), main_url); |
| 631 | 631 |
| 632 // 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. |
| 633 FrameTreeNode* root = | 633 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 634 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 635 GetFrameTree()->root(); | |
| 636 | 634 |
| 637 TestNavigationObserver observer(shell()->web_contents()); | 635 TestNavigationObserver observer(shell()->web_contents()); |
| 638 | 636 |
| 639 // Load same-site page into iframe. | 637 // Load same-site page into iframe. |
| 640 FrameTreeNode* child = root->child_at(0); | 638 FrameTreeNode* child = root->child_at(0); |
| 641 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 639 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 642 NavigateFrameToURL(child, http_url); | 640 NavigateFrameToURL(child, http_url); |
| 643 EXPECT_EQ(http_url, observer.last_navigation_url()); | 641 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 644 EXPECT_TRUE(observer.last_navigation_succeeded()); | 642 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 645 { | 643 { |
| 646 // There should be only one RenderWidgetHost when there are no | 644 // There should be only one RenderWidgetHost when there are no |
| 647 // cross-process iframes. | 645 // cross-process iframes. |
| 648 std::set<RenderWidgetHostView*> views_set = | 646 std::set<RenderWidgetHostView*> views_set = |
| 649 static_cast<WebContentsImpl*>(shell()->web_contents()) | 647 web_contents()->GetRenderWidgetHostViewsInTree(); |
| 650 ->GetRenderWidgetHostViewsInTree(); | |
| 651 EXPECT_EQ(1U, views_set.size()); | 648 EXPECT_EQ(1U, views_set.size()); |
| 652 } | 649 } |
| 653 | 650 |
| 654 EXPECT_EQ( | 651 EXPECT_EQ( |
| 655 " Site A\n" | 652 " Site A\n" |
| 656 " |--Site A\n" | 653 " |--Site A\n" |
| 657 " +--Site A\n" | 654 " +--Site A\n" |
| 658 " |--Site A\n" | 655 " |--Site A\n" |
| 659 " +--Site A\n" | 656 " +--Site A\n" |
| 660 " +--Site A\n" | 657 " +--Site A\n" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 673 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); | 670 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
| 674 RenderViewHost* rvh = child->current_frame_host()->render_view_host(); | 671 RenderViewHost* rvh = child->current_frame_host()->render_view_host(); |
| 675 RenderProcessHost* rph = child->current_frame_host()->GetProcess(); | 672 RenderProcessHost* rph = child->current_frame_host()->GetProcess(); |
| 676 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh); | 673 EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh); |
| 677 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | 674 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
| 678 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph); | 675 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph); |
| 679 { | 676 { |
| 680 // There should be now two RenderWidgetHosts, one for each process | 677 // There should be now two RenderWidgetHosts, one for each process |
| 681 // rendering a frame. | 678 // rendering a frame. |
| 682 std::set<RenderWidgetHostView*> views_set = | 679 std::set<RenderWidgetHostView*> views_set = |
| 683 static_cast<WebContentsImpl*>(shell()->web_contents()) | 680 web_contents()->GetRenderWidgetHostViewsInTree(); |
| 684 ->GetRenderWidgetHostViewsInTree(); | |
| 685 EXPECT_EQ(2U, views_set.size()); | 681 EXPECT_EQ(2U, views_set.size()); |
| 686 } | 682 } |
| 687 RenderFrameProxyHost* proxy_to_parent = | 683 RenderFrameProxyHost* proxy_to_parent = |
| 688 child->render_manager()->GetProxyToParent(); | 684 child->render_manager()->GetProxyToParent(); |
| 689 EXPECT_TRUE(proxy_to_parent); | 685 EXPECT_TRUE(proxy_to_parent); |
| 690 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 686 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
| 691 // The out-of-process iframe should have its own RenderWidgetHost, | 687 // The out-of-process iframe should have its own RenderWidgetHost, |
| 692 // independent of any RenderViewHost. | 688 // independent of any RenderViewHost. |
| 693 EXPECT_NE( | 689 EXPECT_NE( |
| 694 rvh->GetWidget()->GetView(), | 690 rvh->GetWidget()->GetView(), |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 721 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); | 717 EXPECT_NE(rvh, child->current_frame_host()->render_view_host()); |
| 722 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 718 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 723 child->current_frame_host()->GetSiteInstance()); | 719 child->current_frame_host()->GetSiteInstance()); |
| 724 EXPECT_NE(site_instance, | 720 EXPECT_NE(site_instance, |
| 725 child->current_frame_host()->GetSiteInstance()); | 721 child->current_frame_host()->GetSiteInstance()); |
| 726 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), | 722 EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), |
| 727 child->current_frame_host()->GetProcess()); | 723 child->current_frame_host()->GetProcess()); |
| 728 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); | 724 EXPECT_NE(rph, child->current_frame_host()->GetProcess()); |
| 729 { | 725 { |
| 730 std::set<RenderWidgetHostView*> views_set = | 726 std::set<RenderWidgetHostView*> views_set = |
| 731 static_cast<WebContentsImpl*>(shell()->web_contents()) | 727 web_contents()->GetRenderWidgetHostViewsInTree(); |
| 732 ->GetRenderWidgetHostViewsInTree(); | |
| 733 EXPECT_EQ(2U, views_set.size()); | 728 EXPECT_EQ(2U, views_set.size()); |
| 734 } | 729 } |
| 735 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); | 730 EXPECT_EQ(proxy_to_parent, child->render_manager()->GetProxyToParent()); |
| 736 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); | 731 EXPECT_TRUE(proxy_to_parent->cross_process_frame_connector()); |
| 737 EXPECT_NE( | 732 EXPECT_NE( |
| 738 child->current_frame_host()->render_view_host()->GetWidget()->GetView(), | 733 child->current_frame_host()->render_view_host()->GetWidget()->GetView(), |
| 739 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); | 734 proxy_to_parent->cross_process_frame_connector()->get_view_for_testing()); |
| 740 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); | 735 EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost()); |
| 741 | 736 |
| 742 EXPECT_EQ( | 737 EXPECT_EQ( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 #else | 784 #else |
| 790 #define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest | 785 #define MAYBE_NestedSurfaceHitTestTest NestedSurfaceHitTestTest |
| 791 #endif | 786 #endif |
| 792 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 787 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 793 MAYBE_NestedSurfaceHitTestTest) { | 788 MAYBE_NestedSurfaceHitTestTest) { |
| 794 GURL main_url(embedded_test_server()->GetURL( | 789 GURL main_url(embedded_test_server()->GetURL( |
| 795 "/frame_tree/page_with_positioned_nested_frames.html")); | 790 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 796 NavigateToURL(shell(), main_url); | 791 NavigateToURL(shell(), main_url); |
| 797 | 792 |
| 798 // It is safe to obtain the root frame tree node here, as it doesn't change. | 793 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 799 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 794 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 800 ->GetFrameTree() | |
| 801 ->root(); | |
| 802 ASSERT_EQ(1U, root->child_count()); | 795 ASSERT_EQ(1U, root->child_count()); |
| 803 | 796 |
| 804 FrameTreeNode* parent_iframe_node = root->child_at(0); | 797 FrameTreeNode* parent_iframe_node = root->child_at(0); |
| 805 GURL site_url(embedded_test_server()->GetURL( | 798 GURL site_url(embedded_test_server()->GetURL( |
| 806 "a.com", "/frame_tree/page_with_positioned_frame.html")); | 799 "a.com", "/frame_tree/page_with_positioned_frame.html")); |
| 807 EXPECT_EQ(site_url, parent_iframe_node->current_url()); | 800 EXPECT_EQ(site_url, parent_iframe_node->current_url()); |
| 808 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 801 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 809 parent_iframe_node->current_frame_host()->GetSiteInstance()); | 802 parent_iframe_node->current_frame_host()->GetSiteInstance()); |
| 810 | 803 |
| 811 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0); | 804 FrameTreeNode* nested_iframe_node = parent_iframe_node->child_at(0); |
| 812 GURL nested_site_url( | 805 GURL nested_site_url( |
| 813 embedded_test_server()->GetURL("baz.com", "/title1.html")); | 806 embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| 814 EXPECT_EQ(nested_site_url, nested_iframe_node->current_url()); | 807 EXPECT_EQ(nested_site_url, nested_iframe_node->current_url()); |
| 815 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 808 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 816 nested_iframe_node->current_frame_host()->GetSiteInstance()); | 809 nested_iframe_node->current_frame_host()->GetSiteInstance()); |
| 817 EXPECT_NE(parent_iframe_node->current_frame_host()->GetSiteInstance(), | 810 EXPECT_NE(parent_iframe_node->current_frame_host()->GetSiteInstance(), |
| 818 nested_iframe_node->current_frame_host()->GetSiteInstance()); | 811 nested_iframe_node->current_frame_host()->GetSiteInstance()); |
| 819 | 812 |
| 820 // Create listeners for mouse events. | 813 // Create listeners for mouse events. |
| 821 RenderWidgetHostMouseEventMonitor main_frame_monitor( | 814 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 822 root->current_frame_host()->GetRenderWidgetHost()); | 815 root->current_frame_host()->GetRenderWidgetHost()); |
| 823 RenderWidgetHostMouseEventMonitor nested_frame_monitor( | 816 RenderWidgetHostMouseEventMonitor nested_frame_monitor( |
| 824 nested_iframe_node->current_frame_host()->GetRenderWidgetHost()); | 817 nested_iframe_node->current_frame_host()->GetRenderWidgetHost()); |
| 825 | 818 |
| 826 RenderWidgetHostInputEventRouter* router = | 819 RenderWidgetHostInputEventRouter* router = |
| 827 static_cast<WebContentsImpl*>(shell()->web_contents()) | 820 web_contents()->GetInputEventRouter(); |
| 828 ->GetInputEventRouter(); | |
| 829 | 821 |
| 830 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 822 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 831 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 823 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 832 RenderWidgetHostViewBase* rwhv_nested = | 824 RenderWidgetHostViewBase* rwhv_nested = |
| 833 static_cast<RenderWidgetHostViewBase*>( | 825 static_cast<RenderWidgetHostViewBase*>( |
| 834 nested_iframe_node->current_frame_host() | 826 nested_iframe_node->current_frame_host() |
| 835 ->GetRenderWidgetHost() | 827 ->GetRenderWidgetHost() |
| 836 ->GetView()); | 828 ->GetView()); |
| 837 | 829 |
| 838 SurfaceHitTestReadyNotifier notifier( | 830 SurfaceHitTestReadyNotifier notifier( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 #else | 862 #else |
| 871 #define MAYBE_SurfaceHitTestPointerEventsNone SurfaceHitTestPointerEventsNone | 863 #define MAYBE_SurfaceHitTestPointerEventsNone SurfaceHitTestPointerEventsNone |
| 872 #endif | 864 #endif |
| 873 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 865 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 874 MAYBE_SurfaceHitTestPointerEventsNone) { | 866 MAYBE_SurfaceHitTestPointerEventsNone) { |
| 875 GURL main_url(embedded_test_server()->GetURL( | 867 GURL main_url(embedded_test_server()->GetURL( |
| 876 "/frame_tree/page_with_positioned_frame_pointer-events_none.html")); | 868 "/frame_tree/page_with_positioned_frame_pointer-events_none.html")); |
| 877 NavigateToURL(shell(), main_url); | 869 NavigateToURL(shell(), main_url); |
| 878 | 870 |
| 879 // It is safe to obtain the root frame tree node here, as it doesn't change. | 871 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 880 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 872 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 881 ->GetFrameTree() | |
| 882 ->root(); | |
| 883 ASSERT_EQ(1U, root->child_count()); | 873 ASSERT_EQ(1U, root->child_count()); |
| 884 | 874 |
| 885 FrameTreeNode* child_node = root->child_at(0); | 875 FrameTreeNode* child_node = root->child_at(0); |
| 886 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 876 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| 887 EXPECT_EQ(site_url, child_node->current_url()); | 877 EXPECT_EQ(site_url, child_node->current_url()); |
| 888 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 878 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 889 child_node->current_frame_host()->GetSiteInstance()); | 879 child_node->current_frame_host()->GetSiteInstance()); |
| 890 | 880 |
| 891 // Create listeners for mouse events. | 881 // Create listeners for mouse events. |
| 892 RenderWidgetHostMouseEventMonitor main_frame_monitor( | 882 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 893 root->current_frame_host()->GetRenderWidgetHost()); | 883 root->current_frame_host()->GetRenderWidgetHost()); |
| 894 RenderWidgetHostMouseEventMonitor child_frame_monitor( | 884 RenderWidgetHostMouseEventMonitor child_frame_monitor( |
| 895 child_node->current_frame_host()->GetRenderWidgetHost()); | 885 child_node->current_frame_host()->GetRenderWidgetHost()); |
| 896 | 886 |
| 897 RenderWidgetHostInputEventRouter* router = | 887 RenderWidgetHostInputEventRouter* router = |
| 898 static_cast<WebContentsImpl*>(shell()->web_contents()) | 888 web_contents()->GetInputEventRouter(); |
| 899 ->GetInputEventRouter(); | |
| 900 | 889 |
| 901 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 890 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 902 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 891 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 903 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 892 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 904 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 893 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 905 | 894 |
| 906 SurfaceHitTestReadyNotifier notifier( | 895 SurfaceHitTestReadyNotifier notifier( |
| 907 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 896 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
| 908 notifier.WaitForSurfaceReady(); | 897 notifier.WaitForSurfaceReady(); |
| 909 | 898 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 932 #else | 921 #else |
| 933 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped | 922 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped |
| 934 #endif | 923 #endif |
| 935 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 924 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 936 MAYBE_CompositorFrameSwapped) { | 925 MAYBE_CompositorFrameSwapped) { |
| 937 GURL main_url(embedded_test_server()->GetURL( | 926 GURL main_url(embedded_test_server()->GetURL( |
| 938 "a.com", "/cross_site_iframe_factory.html?a(baz)")); | 927 "a.com", "/cross_site_iframe_factory.html?a(baz)")); |
| 939 NavigateToURL(shell(), main_url); | 928 NavigateToURL(shell(), main_url); |
| 940 | 929 |
| 941 // It is safe to obtain the root frame tree node here, as it doesn't change. | 930 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 942 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 931 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 943 ->GetFrameTree() | |
| 944 ->root(); | |
| 945 ASSERT_EQ(1U, root->child_count()); | 932 ASSERT_EQ(1U, root->child_count()); |
| 946 | 933 |
| 947 FrameTreeNode* child_node = root->child_at(0); | 934 FrameTreeNode* child_node = root->child_at(0); |
| 948 GURL site_url(embedded_test_server()->GetURL( | 935 GURL site_url(embedded_test_server()->GetURL( |
| 949 "baz.com", "/cross_site_iframe_factory.html?baz()")); | 936 "baz.com", "/cross_site_iframe_factory.html?baz()")); |
| 950 EXPECT_EQ(site_url, child_node->current_url()); | 937 EXPECT_EQ(site_url, child_node->current_url()); |
| 951 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 938 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 952 child_node->current_frame_host()->GetSiteInstance()); | 939 child_node->current_frame_host()->GetSiteInstance()); |
| 953 RenderWidgetHostViewBase* rwhv_base = static_cast<RenderWidgetHostViewBase*>( | 940 RenderWidgetHostViewBase* rwhv_base = static_cast<RenderWidgetHostViewBase*>( |
| 954 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 941 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 965 } | 952 } |
| 966 } | 953 } |
| 967 | 954 |
| 968 // Ensure that OOPIFs are deleted after navigating to a new main frame. | 955 // Ensure that OOPIFs are deleted after navigating to a new main frame. |
| 969 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { | 956 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) { |
| 970 GURL main_url(embedded_test_server()->GetURL( | 957 GURL main_url(embedded_test_server()->GetURL( |
| 971 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 958 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 972 NavigateToURL(shell(), main_url); | 959 NavigateToURL(shell(), main_url); |
| 973 | 960 |
| 974 // It is safe to obtain the root frame tree node here, as it doesn't change. | 961 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 975 FrameTreeNode* root = | 962 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 976 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 977 GetFrameTree()->root(); | |
| 978 | 963 |
| 979 TestNavigationObserver observer(shell()->web_contents()); | 964 TestNavigationObserver observer(shell()->web_contents()); |
| 980 | 965 |
| 981 // Load a cross-site page into both iframes. | 966 // Load a cross-site page into both iframes. |
| 982 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 967 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 983 NavigateFrameToURL(root->child_at(0), foo_url); | 968 NavigateFrameToURL(root->child_at(0), foo_url); |
| 984 EXPECT_TRUE(observer.last_navigation_succeeded()); | 969 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 985 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 970 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 986 NavigateFrameToURL(root->child_at(1), foo_url); | 971 NavigateFrameToURL(root->child_at(1), foo_url); |
| 987 EXPECT_TRUE(observer.last_navigation_succeeded()); | 972 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1024 EXPECT_FALSE(RenderViewHost::FromID(subframe_process_id, subframe_rvh_id)); | 1009 EXPECT_FALSE(RenderViewHost::FromID(subframe_process_id, subframe_rvh_id)); |
| 1025 } | 1010 } |
| 1026 | 1011 |
| 1027 // Ensure that root frames cannot be detached. | 1012 // Ensure that root frames cannot be detached. |
| 1028 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RestrictFrameDetach) { | 1013 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RestrictFrameDetach) { |
| 1029 GURL main_url(embedded_test_server()->GetURL( | 1014 GURL main_url(embedded_test_server()->GetURL( |
| 1030 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 1015 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 1031 NavigateToURL(shell(), main_url); | 1016 NavigateToURL(shell(), main_url); |
| 1032 | 1017 |
| 1033 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1018 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1034 FrameTreeNode* root = | 1019 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1035 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1036 GetFrameTree()->root(); | |
| 1037 | 1020 |
| 1038 TestNavigationObserver observer(shell()->web_contents()); | 1021 TestNavigationObserver observer(shell()->web_contents()); |
| 1039 | 1022 |
| 1040 // Load cross-site pages into both iframes. | 1023 // Load cross-site pages into both iframes. |
| 1041 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 1024 GURL foo_url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 1042 NavigateFrameToURL(root->child_at(0), foo_url); | 1025 NavigateFrameToURL(root->child_at(0), foo_url); |
| 1043 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1026 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1044 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 1027 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 1045 GURL bar_url = embedded_test_server()->GetURL("bar.com", "/title2.html"); | 1028 GURL bar_url = embedded_test_server()->GetURL("bar.com", "/title2.html"); |
| 1046 NavigateFrameToURL(root->child_at(1), bar_url); | 1029 NavigateFrameToURL(root->child_at(1), bar_url); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1088 " C = http://bar.com/", | 1071 " C = http://bar.com/", |
| 1089 DepictFrameTree(root)); | 1072 DepictFrameTree(root)); |
| 1090 } | 1073 } |
| 1091 | 1074 |
| 1092 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) { | 1075 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteFrame) { |
| 1093 GURL main_url(embedded_test_server()->GetURL( | 1076 GURL main_url(embedded_test_server()->GetURL( |
| 1094 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 1077 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 1095 NavigateToURL(shell(), main_url); | 1078 NavigateToURL(shell(), main_url); |
| 1096 | 1079 |
| 1097 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1080 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1098 FrameTreeNode* root = | 1081 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1099 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1100 GetFrameTree()->root(); | |
| 1101 | 1082 |
| 1102 TestNavigationObserver observer(shell()->web_contents()); | 1083 TestNavigationObserver observer(shell()->web_contents()); |
| 1103 | 1084 |
| 1104 // Load same-site page into iframe. | 1085 // Load same-site page into iframe. |
| 1105 FrameTreeNode* child = root->child_at(0); | 1086 FrameTreeNode* child = root->child_at(0); |
| 1106 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1087 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1107 NavigateFrameToURL(child, http_url); | 1088 NavigateFrameToURL(child, http_url); |
| 1108 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1089 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1109 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1090 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1110 | 1091 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1157 child->current_frame_host()->GetSiteInstance()); | 1138 child->current_frame_host()->GetSiteInstance()); |
| 1158 } | 1139 } |
| 1159 | 1140 |
| 1160 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1141 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1161 NavigateRemoteFrameToBlankAndDataURLs) { | 1142 NavigateRemoteFrameToBlankAndDataURLs) { |
| 1162 GURL main_url(embedded_test_server()->GetURL( | 1143 GURL main_url(embedded_test_server()->GetURL( |
| 1163 "a.com", "/cross_site_iframe_factory.html?a(a,a(a))")); | 1144 "a.com", "/cross_site_iframe_factory.html?a(a,a(a))")); |
| 1164 NavigateToURL(shell(), main_url); | 1145 NavigateToURL(shell(), main_url); |
| 1165 | 1146 |
| 1166 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1147 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1167 FrameTreeNode* root = | 1148 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1168 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1169 GetFrameTree()->root(); | |
| 1170 | 1149 |
| 1171 TestNavigationObserver observer(shell()->web_contents()); | 1150 TestNavigationObserver observer(shell()->web_contents()); |
| 1172 | 1151 |
| 1173 // Load same-site page into iframe. | 1152 // Load same-site page into iframe. |
| 1174 FrameTreeNode* child = root->child_at(0); | 1153 FrameTreeNode* child = root->child_at(0); |
| 1175 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1154 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1176 NavigateFrameToURL(child, http_url); | 1155 NavigateFrameToURL(child, http_url); |
| 1177 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1156 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1178 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1157 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1179 EXPECT_EQ( | 1158 EXPECT_EQ( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 // | 1244 // |
| 1266 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to | 1245 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to |
| 1267 // site B and stays in not rendered state. | 1246 // site B and stays in not rendered state. |
| 1268 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1247 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1269 NavigateRemoteFrameToKilledProcess) { | 1248 NavigateRemoteFrameToKilledProcess) { |
| 1270 GURL main_url(embedded_test_server()->GetURL( | 1249 GURL main_url(embedded_test_server()->GetURL( |
| 1271 "foo.com", "/cross_site_iframe_factory.html?foo.com(bar.com, foo.com)")); | 1250 "foo.com", "/cross_site_iframe_factory.html?foo.com(bar.com, foo.com)")); |
| 1272 NavigateToURL(shell(), main_url); | 1251 NavigateToURL(shell(), main_url); |
| 1273 | 1252 |
| 1274 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1253 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1275 FrameTreeNode* root = | 1254 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1276 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1277 GetFrameTree()->root(); | |
| 1278 | 1255 |
| 1279 TestNavigationObserver observer(shell()->web_contents()); | 1256 TestNavigationObserver observer(shell()->web_contents()); |
| 1280 ASSERT_EQ(2U, root->child_count()); | 1257 ASSERT_EQ(2U, root->child_count()); |
| 1281 | 1258 |
| 1282 // Make sure node2 points to the correct cross-site page. | 1259 // Make sure node2 points to the correct cross-site page. |
| 1283 GURL site_b_url = embedded_test_server()->GetURL( | 1260 GURL site_b_url = embedded_test_server()->GetURL( |
| 1284 "bar.com", "/cross_site_iframe_factory.html?bar.com()"); | 1261 "bar.com", "/cross_site_iframe_factory.html?bar.com()"); |
| 1285 FrameTreeNode* node2 = root->child_at(0); | 1262 FrameTreeNode* node2 = root->child_at(0); |
| 1286 EXPECT_EQ(site_b_url, node2->current_url()); | 1263 EXPECT_EQ(site_b_url, node2->current_url()); |
| 1287 | 1264 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1316 // | 1293 // |
| 1317 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to | 1294 // Note that due to http://crbug.com/450681, node2 cannot be re-navigated to |
| 1318 // site B and stays in not rendered state. | 1295 // site B and stays in not rendered state. |
| 1319 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1296 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1320 NavigateRemoteFrameToKilledProcessWithSubtree) { | 1297 NavigateRemoteFrameToKilledProcessWithSubtree) { |
| 1321 GURL main_url(embedded_test_server()->GetURL( | 1298 GURL main_url(embedded_test_server()->GetURL( |
| 1322 "a.com", "/cross_site_iframe_factory.html?a(bar(baz), a)")); | 1299 "a.com", "/cross_site_iframe_factory.html?a(bar(baz), a)")); |
| 1323 NavigateToURL(shell(), main_url); | 1300 NavigateToURL(shell(), main_url); |
| 1324 | 1301 |
| 1325 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1302 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1326 FrameTreeNode* root = | 1303 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1327 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1328 GetFrameTree()->root(); | |
| 1329 TestNavigationObserver observer(shell()->web_contents()); | 1304 TestNavigationObserver observer(shell()->web_contents()); |
| 1330 | 1305 |
| 1331 ASSERT_EQ(2U, root->child_count()); | 1306 ASSERT_EQ(2U, root->child_count()); |
| 1332 | 1307 |
| 1333 GURL site_b_url(embedded_test_server()->GetURL( | 1308 GURL site_b_url(embedded_test_server()->GetURL( |
| 1334 "bar.com", "/cross_site_iframe_factory.html?bar(baz())")); | 1309 "bar.com", "/cross_site_iframe_factory.html?bar(baz())")); |
| 1335 // We can't use a TestNavigationObserver to verify the URL here, | 1310 // We can't use a TestNavigationObserver to verify the URL here, |
| 1336 // since the frame has children that may have clobbered it in the observer. | 1311 // since the frame has children that may have clobbered it in the observer. |
| 1337 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); | 1312 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); |
| 1338 | 1313 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1403 | 1378 |
| 1404 // Ensure that the renderer process doesn't crash when the main frame navigates | 1379 // Ensure that the renderer process doesn't crash when the main frame navigates |
| 1405 // a remote child to a page that results in a network error. | 1380 // a remote child to a page that results in a network error. |
| 1406 // See https://crbug.com/558016. | 1381 // See https://crbug.com/558016. |
| 1407 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { | 1382 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateRemoteAfterError) { |
| 1408 GURL main_url(embedded_test_server()->GetURL( | 1383 GURL main_url(embedded_test_server()->GetURL( |
| 1409 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 1384 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1410 NavigateToURL(shell(), main_url); | 1385 NavigateToURL(shell(), main_url); |
| 1411 | 1386 |
| 1412 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1387 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1413 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1388 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1414 ->GetFrameTree() | |
| 1415 ->root(); | |
| 1416 | 1389 |
| 1417 // Load same-site page into iframe. | 1390 // Load same-site page into iframe. |
| 1418 { | 1391 { |
| 1419 TestNavigationObserver observer(shell()->web_contents()); | 1392 TestNavigationObserver observer(shell()->web_contents()); |
| 1420 FrameTreeNode* child = root->child_at(0); | 1393 FrameTreeNode* child = root->child_at(0); |
| 1421 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1394 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1422 NavigateFrameToURL(child, http_url); | 1395 NavigateFrameToURL(child, http_url); |
| 1423 EXPECT_EQ(http_url, observer.last_navigation_url()); | 1396 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 1424 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1397 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 1425 observer.Wait(); | 1398 observer.Wait(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1459 // successfully loads after earlier encountering a network error for it. | 1432 // successfully loads after earlier encountering a network error for it. |
| 1460 // See https://crbug.com/560511. | 1433 // See https://crbug.com/560511. |
| 1461 // TODO(creis): Make the net error page show in the correct process as well, | 1434 // TODO(creis): Make the net error page show in the correct process as well, |
| 1462 // per https://crbug.com/588314. | 1435 // per https://crbug.com/588314. |
| 1463 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ProcessTransferAfterError) { | 1436 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ProcessTransferAfterError) { |
| 1464 GURL main_url(embedded_test_server()->GetURL( | 1437 GURL main_url(embedded_test_server()->GetURL( |
| 1465 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 1438 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 1466 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1439 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1467 | 1440 |
| 1468 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1441 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1469 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1442 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1470 ->GetFrameTree() | |
| 1471 ->root(); | |
| 1472 FrameTreeNode* child = root->child_at(0); | 1443 FrameTreeNode* child = root->child_at(0); |
| 1473 GURL url_a = child->current_url(); | 1444 GURL url_a = child->current_url(); |
| 1474 | 1445 |
| 1475 // Disable host resolution in the test server and try to navigate the subframe | 1446 // Disable host resolution in the test server and try to navigate the subframe |
| 1476 // cross-site, which will lead to a committed net error (which looks like | 1447 // cross-site, which will lead to a committed net error (which looks like |
| 1477 // success to the TestNavigationObserver). | 1448 // success to the TestNavigationObserver). |
| 1478 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); | 1449 GURL url_b = embedded_test_server()->GetURL("b.com", "/title3.html"); |
| 1479 host_resolver()->ClearRules(); | 1450 host_resolver()->ClearRules(); |
| 1480 TestNavigationObserver observer(shell()->web_contents()); | 1451 TestNavigationObserver observer(shell()->web_contents()); |
| 1481 NavigateIframeToURL(shell()->web_contents(), "child-0", url_b); | 1452 NavigateIframeToURL(shell()->web_contents(), "child-0", url_b); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1563 // verifying that a proxy for node 4 has been recreated in process B. This | 1534 // verifying that a proxy for node 4 has been recreated in process B. This |
| 1564 // verifies the fix for https://crbug.com/478892. | 1535 // verifies the fix for https://crbug.com/478892. |
| 1565 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1536 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1566 NavigatingToKilledProcessRestoresAllProxies) { | 1537 NavigatingToKilledProcessRestoresAllProxies) { |
| 1567 // Navigate to a page with three frames: one cross-site and two same-site. | 1538 // Navigate to a page with three frames: one cross-site and two same-site. |
| 1568 GURL main_url(embedded_test_server()->GetURL( | 1539 GURL main_url(embedded_test_server()->GetURL( |
| 1569 "a.com", "/frame_tree/page_with_three_frames.html")); | 1540 "a.com", "/frame_tree/page_with_three_frames.html")); |
| 1570 NavigateToURL(shell(), main_url); | 1541 NavigateToURL(shell(), main_url); |
| 1571 | 1542 |
| 1572 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1543 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1573 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1544 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1574 ->GetFrameTree() | |
| 1575 ->root(); | |
| 1576 TestNavigationObserver observer(shell()->web_contents()); | 1545 TestNavigationObserver observer(shell()->web_contents()); |
| 1577 | 1546 |
| 1578 EXPECT_EQ( | 1547 EXPECT_EQ( |
| 1579 " Site A ------------ proxies for B\n" | 1548 " Site A ------------ proxies for B\n" |
| 1580 " |--Site B ------- proxies for A\n" | 1549 " |--Site B ------- proxies for A\n" |
| 1581 " |--Site A ------- proxies for B\n" | 1550 " |--Site A ------- proxies for B\n" |
| 1582 " +--Site A ------- proxies for B\n" | 1551 " +--Site A ------- proxies for B\n" |
| 1583 "Where A = http://a.com/\n" | 1552 "Where A = http://a.com/\n" |
| 1584 " B = http://b.com/", | 1553 " B = http://b.com/", |
| 1585 DepictFrameTree(root)); | 1554 DepictFrameTree(root)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1628 // process A, and then checks that process B isn't resurrected to create a | 1597 // process A, and then checks that process B isn't resurrected to create a |
| 1629 // proxy for the new child frame. See https://crbug.com/476846. | 1598 // proxy for the new child frame. See https://crbug.com/476846. |
| 1630 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1599 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1631 CreateChildFrameAfterKillingProcess) { | 1600 CreateChildFrameAfterKillingProcess) { |
| 1632 // Navigate to a page with three frames: one cross-site and two same-site. | 1601 // Navigate to a page with three frames: one cross-site and two same-site. |
| 1633 GURL main_url(embedded_test_server()->GetURL( | 1602 GURL main_url(embedded_test_server()->GetURL( |
| 1634 "a.com", "/frame_tree/page_with_three_frames.html")); | 1603 "a.com", "/frame_tree/page_with_three_frames.html")); |
| 1635 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1604 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1636 | 1605 |
| 1637 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1606 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1638 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1607 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1639 ->GetFrameTree() | |
| 1640 ->root(); | |
| 1641 | 1608 |
| 1642 EXPECT_EQ( | 1609 EXPECT_EQ( |
| 1643 " Site A ------------ proxies for B\n" | 1610 " Site A ------------ proxies for B\n" |
| 1644 " |--Site B ------- proxies for A\n" | 1611 " |--Site B ------- proxies for A\n" |
| 1645 " |--Site A ------- proxies for B\n" | 1612 " |--Site A ------- proxies for B\n" |
| 1646 " +--Site A ------- proxies for B\n" | 1613 " +--Site A ------- proxies for B\n" |
| 1647 "Where A = http://a.com/\n" | 1614 "Where A = http://a.com/\n" |
| 1648 " B = http://b.com/", | 1615 " B = http://b.com/", |
| 1649 DepictFrameTree(root)); | 1616 DepictFrameTree(root)); |
| 1650 SiteInstance* b_site_instance = | 1617 SiteInstance* b_site_instance = |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1705 // for which its parent has proxies. This includes A. However, even though | 1672 // for which its parent has proxies. This includes A. However, even though |
| 1706 // process A is live (step 4), the parent proxy in A is not live (which was | 1673 // process A is live (step 4), the parent proxy in A is not live (which was |
| 1707 // incorrectly assumed previously). This is because step 4 does not resurrect | 1674 // incorrectly assumed previously). This is because step 4 does not resurrect |
| 1708 // proxies for popups opened before the crash. | 1675 // proxies for popups opened before the crash. |
| 1709 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1676 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1710 CreateChildFrameAfterKillingOpener) { | 1677 CreateChildFrameAfterKillingOpener) { |
| 1711 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 1678 GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 1712 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1679 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1713 | 1680 |
| 1714 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1681 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1715 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1682 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1716 ->GetFrameTree() | |
| 1717 ->root(); | |
| 1718 SiteInstance* site_instance_a = root->current_frame_host()->GetSiteInstance(); | 1683 SiteInstance* site_instance_a = root->current_frame_host()->GetSiteInstance(); |
| 1719 | 1684 |
| 1720 // Open a popup and navigate it cross-process to b.com. | 1685 // Open a popup and navigate it cross-process to b.com. |
| 1721 ShellAddedObserver new_shell_observer; | 1686 ShellAddedObserver new_shell_observer; |
| 1722 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), | 1687 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), |
| 1723 "popup = window.open('about:blank');")); | 1688 "popup = window.open('about:blank');")); |
| 1724 Shell* popup = new_shell_observer.GetShell(); | 1689 Shell* popup = new_shell_observer.GetShell(); |
| 1725 GURL popup_url(embedded_test_server()->GetURL("b.com", "/title2.html")); | 1690 GURL popup_url(embedded_test_server()->GetURL("b.com", "/title2.html")); |
| 1726 EXPECT_TRUE(NavigateToURL(popup, popup_url)); | 1691 EXPECT_TRUE(NavigateToURL(popup, popup_url)); |
| 1727 | 1692 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1793 // node1 is the root. | 1758 // node1 is the root. |
| 1794 // Initially, both node1.proxy_hosts_ and node3.proxy_hosts_ contain C. | 1759 // Initially, both node1.proxy_hosts_ and node3.proxy_hosts_ contain C. |
| 1795 // After we kill B, make sure proxies for C are cleared. | 1760 // After we kill B, make sure proxies for C are cleared. |
| 1796 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 1761 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 1797 KillingRendererClearsDescendantProxies) { | 1762 KillingRendererClearsDescendantProxies) { |
| 1798 GURL main_url(embedded_test_server()->GetURL( | 1763 GURL main_url(embedded_test_server()->GetURL( |
| 1799 "a.com", "/frame_tree/page_with_two_frames_nested.html")); | 1764 "a.com", "/frame_tree/page_with_two_frames_nested.html")); |
| 1800 NavigateToURL(shell(), main_url); | 1765 NavigateToURL(shell(), main_url); |
| 1801 | 1766 |
| 1802 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1767 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1803 FrameTreeNode* root = | 1768 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1804 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1805 GetFrameTree()->root(); | |
| 1806 ASSERT_EQ(2U, root->child_count()); | 1769 ASSERT_EQ(2U, root->child_count()); |
| 1807 | 1770 |
| 1808 GURL site_b_url( | 1771 GURL site_b_url( |
| 1809 embedded_test_server()->GetURL( | 1772 embedded_test_server()->GetURL( |
| 1810 "bar.com", "/frame_tree/page_with_one_frame.html")); | 1773 "bar.com", "/frame_tree/page_with_one_frame.html")); |
| 1811 // We can't use a TestNavigationObserver to verify the URL here, | 1774 // We can't use a TestNavigationObserver to verify the URL here, |
| 1812 // since the frame has children that may have clobbered it in the observer. | 1775 // since the frame has children that may have clobbered it in the observer. |
| 1813 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); | 1776 EXPECT_EQ(site_b_url, root->child_at(0)->current_url()); |
| 1814 | 1777 |
| 1815 // Ensure that a new process is created for node2. | 1778 // Ensure that a new process is created for node2. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1867 } | 1830 } |
| 1868 | 1831 |
| 1869 // Crash a subframe and ensures its children are cleared from the FrameTree. | 1832 // Crash a subframe and ensures its children are cleared from the FrameTree. |
| 1870 // See http://crbug.com/338508. | 1833 // See http://crbug.com/338508. |
| 1871 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) { | 1834 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrashSubframe) { |
| 1872 GURL main_url(embedded_test_server()->GetURL( | 1835 GURL main_url(embedded_test_server()->GetURL( |
| 1873 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 1836 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 1874 NavigateToURL(shell(), main_url); | 1837 NavigateToURL(shell(), main_url); |
| 1875 | 1838 |
| 1876 // Check the subframe process. | 1839 // Check the subframe process. |
| 1877 FrameTreeNode* root = | 1840 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1878 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 1879 GetFrameTree()->root(); | |
| 1880 EXPECT_EQ( | 1841 EXPECT_EQ( |
| 1881 " Site A ------------ proxies for B\n" | 1842 " Site A ------------ proxies for B\n" |
| 1882 " +--Site B ------- proxies for A\n" | 1843 " +--Site B ------- proxies for A\n" |
| 1883 "Where A = http://a.com/\n" | 1844 "Where A = http://a.com/\n" |
| 1884 " B = http://b.com/", | 1845 " B = http://b.com/", |
| 1885 DepictFrameTree(root)); | 1846 DepictFrameTree(root)); |
| 1886 FrameTreeNode* child = root->child_at(0); | 1847 FrameTreeNode* child = root->child_at(0); |
| 1887 EXPECT_TRUE( | 1848 EXPECT_TRUE( |
| 1888 child->current_frame_host()->render_view_host()->IsRenderViewLive()); | 1849 child->current_frame_host()->render_view_host()->IsRenderViewLive()); |
| 1889 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive()); | 1850 EXPECT_TRUE(child->current_frame_host()->IsRenderFrameLive()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1930 // When a new subframe is added, related SiteInstances that can reach the | 1891 // When a new subframe is added, related SiteInstances that can reach the |
| 1931 // subframe should create proxies for it (https://crbug.com/423587). This test | 1892 // subframe should create proxies for it (https://crbug.com/423587). This test |
| 1932 // checks that if A embeds B and later adds a new subframe A2, A2 gets a proxy | 1893 // checks that if A embeds B and later adds a new subframe A2, A2 gets a proxy |
| 1933 // in B's process. | 1894 // in B's process. |
| 1934 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CreateProxiesForNewFrames) { | 1895 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CreateProxiesForNewFrames) { |
| 1935 GURL main_url(embedded_test_server()->GetURL( | 1896 GURL main_url(embedded_test_server()->GetURL( |
| 1936 "b.com", "/frame_tree/page_with_one_frame.html")); | 1897 "b.com", "/frame_tree/page_with_one_frame.html")); |
| 1937 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 1898 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 1938 | 1899 |
| 1939 // It is safe to obtain the root frame tree node here, as it doesn't change. | 1900 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 1940 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 1901 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 1941 ->GetFrameTree() | |
| 1942 ->root(); | |
| 1943 ASSERT_EQ(1U, root->child_count()); | 1902 ASSERT_EQ(1U, root->child_count()); |
| 1944 | 1903 |
| 1945 // Make sure the frame starts out at the correct cross-site URL. | 1904 // Make sure the frame starts out at the correct cross-site URL. |
| 1946 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), | 1905 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), |
| 1947 root->child_at(0)->current_url()); | 1906 root->child_at(0)->current_url()); |
| 1948 | 1907 |
| 1949 EXPECT_EQ( | 1908 EXPECT_EQ( |
| 1950 " Site A ------------ proxies for B\n" | 1909 " Site A ------------ proxies for B\n" |
| 1951 " +--Site B ------- proxies for A\n" | 1910 " +--Site B ------- proxies for A\n" |
| 1952 "Where A = http://b.com/\n" | 1911 "Where A = http://b.com/\n" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2175 | 2134 |
| 2176 // Ensure that when navigating a frame cross-process RenderFrameProxyHosts are | 2135 // Ensure that when navigating a frame cross-process RenderFrameProxyHosts are |
| 2177 // created in the FrameTree skipping the subtree of the navigating frame. | 2136 // created in the FrameTree skipping the subtree of the navigating frame. |
| 2178 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2137 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2179 ProxyCreationSkipsSubtree) { | 2138 ProxyCreationSkipsSubtree) { |
| 2180 GURL main_url(embedded_test_server()->GetURL( | 2139 GURL main_url(embedded_test_server()->GetURL( |
| 2181 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 2140 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 2182 NavigateToURL(shell(), main_url); | 2141 NavigateToURL(shell(), main_url); |
| 2183 | 2142 |
| 2184 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2143 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2185 FrameTreeNode* root = | 2144 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2186 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 2187 GetFrameTree()->root(); | |
| 2188 | 2145 |
| 2189 EXPECT_TRUE(root->child_at(1) != NULL); | 2146 EXPECT_TRUE(root->child_at(1) != NULL); |
| 2190 EXPECT_EQ(2U, root->child_at(1)->child_count()); | 2147 EXPECT_EQ(2U, root->child_at(1)->child_count()); |
| 2191 | 2148 |
| 2192 { | 2149 { |
| 2193 // Load same-site page into iframe. | 2150 // Load same-site page into iframe. |
| 2194 TestNavigationObserver observer(shell()->web_contents()); | 2151 TestNavigationObserver observer(shell()->web_contents()); |
| 2195 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 2152 GURL http_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 2196 NavigateFrameToURL(root->child_at(0), http_url); | 2153 NavigateFrameToURL(root->child_at(0), http_url); |
| 2197 EXPECT_EQ(http_url, observer.last_navigation_url()); | 2154 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2323 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2280 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2324 MAYBE_FrameOwnerPropertiesPropagationScrolling) { | 2281 MAYBE_FrameOwnerPropertiesPropagationScrolling) { |
| 2325 #if defined(OS_MACOSX) | 2282 #if defined(OS_MACOSX) |
| 2326 ui::test::ScopedPreferredScrollerStyle scroller_style_override(false); | 2283 ui::test::ScopedPreferredScrollerStyle scroller_style_override(false); |
| 2327 #endif | 2284 #endif |
| 2328 GURL main_url(embedded_test_server()->GetURL( | 2285 GURL main_url(embedded_test_server()->GetURL( |
| 2329 "a.com", "/frame_owner_properties_scrolling.html")); | 2286 "a.com", "/frame_owner_properties_scrolling.html")); |
| 2330 NavigateToURL(shell(), main_url); | 2287 NavigateToURL(shell(), main_url); |
| 2331 | 2288 |
| 2332 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2289 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2333 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2290 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2334 ->GetFrameTree() | |
| 2335 ->root(); | |
| 2336 ASSERT_EQ(1u, root->child_count()); | 2291 ASSERT_EQ(1u, root->child_count()); |
| 2337 | 2292 |
| 2338 EXPECT_EQ( | 2293 EXPECT_EQ( |
| 2339 " Site A ------------ proxies for B\n" | 2294 " Site A ------------ proxies for B\n" |
| 2340 " +--Site B ------- proxies for A\n" | 2295 " +--Site B ------- proxies for A\n" |
| 2341 "Where A = http://a.com/\n" | 2296 "Where A = http://a.com/\n" |
| 2342 " B = http://b.com/", | 2297 " B = http://b.com/", |
| 2343 DepictFrameTree(root)); | 2298 DepictFrameTree(root)); |
| 2344 | 2299 |
| 2345 FrameTreeNode* child = root->child_at(0); | 2300 FrameTreeNode* child = root->child_at(0); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2391 | 2346 |
| 2392 // Verify that "marginwidth" and "marginheight" properties on frame elements | 2347 // Verify that "marginwidth" and "marginheight" properties on frame elements |
| 2393 // propagate to child frames correctly. | 2348 // propagate to child frames correctly. |
| 2394 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2349 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2395 FrameOwnerPropertiesPropagationMargin) { | 2350 FrameOwnerPropertiesPropagationMargin) { |
| 2396 GURL main_url(embedded_test_server()->GetURL( | 2351 GURL main_url(embedded_test_server()->GetURL( |
| 2397 "a.com", "/frame_owner_properties_margin.html")); | 2352 "a.com", "/frame_owner_properties_margin.html")); |
| 2398 NavigateToURL(shell(), main_url); | 2353 NavigateToURL(shell(), main_url); |
| 2399 | 2354 |
| 2400 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2355 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2401 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2356 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2402 ->GetFrameTree() | |
| 2403 ->root(); | |
| 2404 ASSERT_EQ(1u, root->child_count()); | 2357 ASSERT_EQ(1u, root->child_count()); |
| 2405 | 2358 |
| 2406 EXPECT_EQ( | 2359 EXPECT_EQ( |
| 2407 " Site A ------------ proxies for B\n" | 2360 " Site A ------------ proxies for B\n" |
| 2408 " +--Site B ------- proxies for A\n" | 2361 " +--Site B ------- proxies for A\n" |
| 2409 "Where A = http://a.com/\n" | 2362 "Where A = http://a.com/\n" |
| 2410 " B = http://b.com/", | 2363 " B = http://b.com/", |
| 2411 DepictFrameTree(root)); | 2364 DepictFrameTree(root)); |
| 2412 | 2365 |
| 2413 FrameTreeNode* child = root->child_at(0); | 2366 FrameTreeNode* child = root->child_at(0); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2480 } | 2433 } |
| 2481 } | 2434 } |
| 2482 | 2435 |
| 2483 // Verify origin replication with an A-embed-B-embed-C-embed-A hierarchy. | 2436 // Verify origin replication with an A-embed-B-embed-C-embed-A hierarchy. |
| 2484 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginReplication) { | 2437 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginReplication) { |
| 2485 GURL main_url(embedded_test_server()->GetURL( | 2438 GURL main_url(embedded_test_server()->GetURL( |
| 2486 "a.com", "/cross_site_iframe_factory.html?a(b(c(a),b), a)")); | 2439 "a.com", "/cross_site_iframe_factory.html?a(b(c(a),b), a)")); |
| 2487 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2440 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2488 | 2441 |
| 2489 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2442 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2490 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2443 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2491 ->GetFrameTree() | |
| 2492 ->root(); | |
| 2493 | 2444 |
| 2494 EXPECT_EQ( | 2445 EXPECT_EQ( |
| 2495 " Site A ------------ proxies for B C\n" | 2446 " Site A ------------ proxies for B C\n" |
| 2496 " |--Site B ------- proxies for A C\n" // tiptop_child | 2447 " |--Site B ------- proxies for A C\n" // tiptop_child |
| 2497 " | |--Site C -- proxies for A B\n" // middle_child | 2448 " | |--Site C -- proxies for A B\n" // middle_child |
| 2498 " | | +--Site A -- proxies for B C\n" // lowest_child | 2449 " | | +--Site A -- proxies for B C\n" // lowest_child |
| 2499 " | +--Site B -- proxies for A C\n" | 2450 " | +--Site B -- proxies for A C\n" |
| 2500 " +--Site A ------- proxies for B C\n" | 2451 " +--Site A ------- proxies for B C\n" |
| 2501 "Where A = http://a.com/\n" | 2452 "Where A = http://a.com/\n" |
| 2502 " B = http://b.com/\n" | 2453 " B = http://b.com/\n" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2571 &result)); | 2522 &result)); |
| 2572 EXPECT_EQ(a_origin, result + "/"); | 2523 EXPECT_EQ(a_origin, result + "/"); |
| 2573 } | 2524 } |
| 2574 | 2525 |
| 2575 // Check that iframe sandbox flags are replicated correctly. | 2526 // Check that iframe sandbox flags are replicated correctly. |
| 2576 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsReplication) { | 2527 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsReplication) { |
| 2577 GURL main_url(embedded_test_server()->GetURL("/sandboxed_frames.html")); | 2528 GURL main_url(embedded_test_server()->GetURL("/sandboxed_frames.html")); |
| 2578 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2529 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2579 | 2530 |
| 2580 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2531 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2581 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2532 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2582 ->GetFrameTree() | |
| 2583 ->root(); | |
| 2584 | 2533 |
| 2585 TestNavigationObserver observer(shell()->web_contents()); | 2534 TestNavigationObserver observer(shell()->web_contents()); |
| 2586 | 2535 |
| 2587 // Navigate the second (sandboxed) subframe to a cross-site page with a | 2536 // Navigate the second (sandboxed) subframe to a cross-site page with a |
| 2588 // subframe. | 2537 // subframe. |
| 2589 GURL foo_url( | 2538 GURL foo_url( |
| 2590 embedded_test_server()->GetURL("foo.com", "/frame_tree/1-1.html")); | 2539 embedded_test_server()->GetURL("foo.com", "/frame_tree/1-1.html")); |
| 2591 NavigateFrameToURL(root->child_at(1), foo_url); | 2540 NavigateFrameToURL(root->child_at(1), foo_url); |
| 2592 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 2541 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
| 2593 | 2542 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2671 EXPECT_EQ(main_url.GetOrigin().spec(), result + "/"); | 2620 EXPECT_EQ(main_url.GetOrigin().spec(), result + "/"); |
| 2672 } | 2621 } |
| 2673 | 2622 |
| 2674 // Check that dynamic updates to iframe sandbox flags are propagated correctly. | 2623 // Check that dynamic updates to iframe sandbox flags are propagated correctly. |
| 2675 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicSandboxFlags) { | 2624 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicSandboxFlags) { |
| 2676 GURL main_url( | 2625 GURL main_url( |
| 2677 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 2626 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 2678 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2627 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2679 | 2628 |
| 2680 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2629 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2681 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2630 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2682 ->GetFrameTree() | |
| 2683 ->root(); | |
| 2684 | 2631 |
| 2685 TestNavigationObserver observer(shell()->web_contents()); | 2632 TestNavigationObserver observer(shell()->web_contents()); |
| 2686 ASSERT_EQ(2U, root->child_count()); | 2633 ASSERT_EQ(2U, root->child_count()); |
| 2687 | 2634 |
| 2688 // Make sure first frame starts out at the correct cross-site page. | 2635 // Make sure first frame starts out at the correct cross-site page. |
| 2689 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), | 2636 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), |
| 2690 root->child_at(0)->current_url()); | 2637 root->child_at(0)->current_url()); |
| 2691 | 2638 |
| 2692 // Navigate second frame to another cross-site page. | 2639 // Navigate second frame to another cross-site page. |
| 2693 GURL baz_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 2640 GURL baz_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2795 } | 2742 } |
| 2796 | 2743 |
| 2797 // Check that dynamic updates to iframe sandbox flags are propagated correctly. | 2744 // Check that dynamic updates to iframe sandbox flags are propagated correctly. |
| 2798 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2745 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2799 DynamicSandboxFlagsRemoteToLocal) { | 2746 DynamicSandboxFlagsRemoteToLocal) { |
| 2800 GURL main_url( | 2747 GURL main_url( |
| 2801 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 2748 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 2802 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2749 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2803 | 2750 |
| 2804 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2751 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2805 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2752 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2806 ->GetFrameTree() | |
| 2807 ->root(); | |
| 2808 | 2753 |
| 2809 TestNavigationObserver observer(shell()->web_contents()); | 2754 TestNavigationObserver observer(shell()->web_contents()); |
| 2810 ASSERT_EQ(2U, root->child_count()); | 2755 ASSERT_EQ(2U, root->child_count()); |
| 2811 | 2756 |
| 2812 // Make sure the two frames starts out at correct URLs. | 2757 // Make sure the two frames starts out at correct URLs. |
| 2813 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), | 2758 EXPECT_EQ(embedded_test_server()->GetURL("bar.com", "/title1.html"), |
| 2814 root->child_at(0)->current_url()); | 2759 root->child_at(0)->current_url()); |
| 2815 EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"), | 2760 EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"), |
| 2816 root->child_at(1)->current_url()); | 2761 root->child_at(1)->current_url()); |
| 2817 | 2762 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2865 } | 2810 } |
| 2866 | 2811 |
| 2867 // Check that dynamic updates to iframe sandbox flags are propagated correctly. | 2812 // Check that dynamic updates to iframe sandbox flags are propagated correctly. |
| 2868 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2813 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2869 DynamicSandboxFlagsRendererInitiatedNavigation) { | 2814 DynamicSandboxFlagsRendererInitiatedNavigation) { |
| 2870 GURL main_url( | 2815 GURL main_url( |
| 2871 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); | 2816 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); |
| 2872 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2817 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2873 | 2818 |
| 2874 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2819 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2875 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2820 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2876 ->GetFrameTree() | |
| 2877 ->root(); | |
| 2878 | 2821 |
| 2879 TestNavigationObserver observer(shell()->web_contents()); | 2822 TestNavigationObserver observer(shell()->web_contents()); |
| 2880 ASSERT_EQ(1U, root->child_count()); | 2823 ASSERT_EQ(1U, root->child_count()); |
| 2881 | 2824 |
| 2882 // Make sure the frame starts out at the correct cross-site page. | 2825 // Make sure the frame starts out at the correct cross-site page. |
| 2883 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), | 2826 EXPECT_EQ(embedded_test_server()->GetURL("baz.com", "/title1.html"), |
| 2884 root->child_at(0)->current_url()); | 2827 root->child_at(0)->current_url()); |
| 2885 | 2828 |
| 2886 // The frame should not be sandboxed to start with. | 2829 // The frame should not be sandboxed to start with. |
| 2887 EXPECT_EQ(blink::WebSandboxFlags::None, | 2830 EXPECT_EQ(blink::WebSandboxFlags::None, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2946 // checking whether the grandchild frame added in step 3 sees proper sandbox | 2889 // checking whether the grandchild frame added in step 3 sees proper sandbox |
| 2947 // flags and origin for its (remote) parent. This wasn't addressed when | 2890 // flags and origin for its (remote) parent. This wasn't addressed when |
| 2948 // https://crbug.com/423587 was fixed. | 2891 // https://crbug.com/423587 was fixed. |
| 2949 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 2892 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2950 ProxiesForNewChildFramesHaveCorrectReplicationState) { | 2893 ProxiesForNewChildFramesHaveCorrectReplicationState) { |
| 2951 GURL main_url( | 2894 GURL main_url( |
| 2952 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); | 2895 embedded_test_server()->GetURL("/frame_tree/page_with_one_frame.html")); |
| 2953 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2896 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 2954 | 2897 |
| 2955 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2898 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2956 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2899 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 2957 ->GetFrameTree() | |
| 2958 ->root(); | |
| 2959 TestNavigationObserver observer(shell()->web_contents()); | 2900 TestNavigationObserver observer(shell()->web_contents()); |
| 2960 | 2901 |
| 2961 EXPECT_EQ( | 2902 EXPECT_EQ( |
| 2962 " Site A ------------ proxies for B\n" | 2903 " Site A ------------ proxies for B\n" |
| 2963 " +--Site B ------- proxies for A\n" | 2904 " +--Site B ------- proxies for A\n" |
| 2964 "Where A = http://127.0.0.1/\n" | 2905 "Where A = http://127.0.0.1/\n" |
| 2965 " B = http://baz.com/", | 2906 " B = http://baz.com/", |
| 2966 DepictFrameTree(root)); | 2907 DepictFrameTree(root)); |
| 2967 | 2908 |
| 2968 // In the root frame, add a new sandboxed local frame, which itself has a | 2909 // 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... | |
| 3027 EXPECT_TRUE(success); | 2968 EXPECT_TRUE(success); |
| 3028 EXPECT_EQ(1u, Shell::windows().size()); | 2969 EXPECT_EQ(1u, Shell::windows().size()); |
| 3029 } | 2970 } |
| 3030 | 2971 |
| 3031 // Verify that a child frame can retrieve the name property set by its parent. | 2972 // Verify that a child frame can retrieve the name property set by its parent. |
| 3032 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, WindowNameReplication) { | 2973 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, WindowNameReplication) { |
| 3033 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); | 2974 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); |
| 3034 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 2975 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3035 | 2976 |
| 3036 // It is safe to obtain the root frame tree node here, as it doesn't change. | 2977 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3037 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 2978 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3038 ->GetFrameTree() | |
| 3039 ->root(); | |
| 3040 | 2979 |
| 3041 TestNavigationObserver observer(shell()->web_contents()); | 2980 TestNavigationObserver observer(shell()->web_contents()); |
| 3042 | 2981 |
| 3043 // Load cross-site page into iframe. | 2982 // Load cross-site page into iframe. |
| 3044 GURL frame_url = | 2983 GURL frame_url = |
| 3045 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); | 2984 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); |
| 3046 NavigateFrameToURL(root->child_at(0), frame_url); | 2985 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3047 EXPECT_TRUE(observer.last_navigation_succeeded()); | 2986 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3048 EXPECT_EQ(frame_url, observer.last_navigation_url()); | 2987 EXPECT_EQ(frame_url, observer.last_navigation_url()); |
| 3049 | 2988 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 3060 EXPECT_EQ("3-1-name", result); | 2999 EXPECT_EQ("3-1-name", result); |
| 3061 } | 3000 } |
| 3062 | 3001 |
| 3063 // Verify that dynamic updates to a frame's window.name propagate to the | 3002 // Verify that dynamic updates to a frame's window.name propagate to the |
| 3064 // frame's proxies, so that the latest frame names can be used in navigations. | 3003 // frame's proxies, so that the latest frame names can be used in navigations. |
| 3065 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicWindowName) { | 3004 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DynamicWindowName) { |
| 3066 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); | 3005 GURL main_url(embedded_test_server()->GetURL("/frame_tree/2-4.html")); |
| 3067 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3006 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3068 | 3007 |
| 3069 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3008 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3070 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3009 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3071 ->GetFrameTree() | |
| 3072 ->root(); | |
| 3073 TestNavigationObserver observer(shell()->web_contents()); | 3010 TestNavigationObserver observer(shell()->web_contents()); |
| 3074 | 3011 |
| 3075 // Load cross-site page into iframe. | 3012 // Load cross-site page into iframe. |
| 3076 GURL frame_url = | 3013 GURL frame_url = |
| 3077 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); | 3014 embedded_test_server()->GetURL("foo.com", "/frame_tree/3-1.html"); |
| 3078 NavigateFrameToURL(root->child_at(0), frame_url); | 3015 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3079 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3016 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3080 EXPECT_EQ(frame_url, observer.last_navigation_url()); | 3017 EXPECT_EQ(frame_url, observer.last_navigation_url()); |
| 3081 | 3018 |
| 3082 // Browser process should know the child frame's original window.name | 3019 // Browser process should know the child frame's original window.name |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3119 } | 3056 } |
| 3120 | 3057 |
| 3121 // Verify that when a frame is navigated to a new origin, the origin update | 3058 // Verify that when a frame is navigated to a new origin, the origin update |
| 3122 // propagates to the frame's proxies. | 3059 // propagates to the frame's proxies. |
| 3123 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginUpdatesReachProxies) { | 3060 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OriginUpdatesReachProxies) { |
| 3124 GURL main_url( | 3061 GURL main_url( |
| 3125 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 3062 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 3126 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3063 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3127 | 3064 |
| 3128 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3065 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3129 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3066 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3130 ->GetFrameTree() | |
| 3131 ->root(); | |
| 3132 TestNavigationObserver observer(shell()->web_contents()); | 3067 TestNavigationObserver observer(shell()->web_contents()); |
| 3133 | 3068 |
| 3134 EXPECT_EQ( | 3069 EXPECT_EQ( |
| 3135 " Site A ------------ proxies for B\n" | 3070 " Site A ------------ proxies for B\n" |
| 3136 " |--Site B ------- proxies for A\n" | 3071 " |--Site B ------- proxies for A\n" |
| 3137 " +--Site A ------- proxies for B\n" | 3072 " +--Site A ------- proxies for B\n" |
| 3138 "Where A = http://127.0.0.1/\n" | 3073 "Where A = http://127.0.0.1/\n" |
| 3139 " B = http://bar.com/", | 3074 " B = http://bar.com/", |
| 3140 DepictFrameTree(root)); | 3075 DepictFrameTree(root)); |
| 3141 | 3076 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3172 << frame_origin << ")"; | 3107 << frame_origin << ")"; |
| 3173 } | 3108 } |
| 3174 | 3109 |
| 3175 // Ensure that navigating subframes in --site-per-process mode properly fires | 3110 // Ensure that navigating subframes in --site-per-process mode properly fires |
| 3176 // the DidStopLoading event on WebContentsObserver. | 3111 // the DidStopLoading event on WebContentsObserver. |
| 3177 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { | 3112 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { |
| 3178 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 3113 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 3179 NavigateToURL(shell(), main_url); | 3114 NavigateToURL(shell(), main_url); |
| 3180 | 3115 |
| 3181 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3116 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3182 FrameTreeNode* root = | 3117 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3183 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
| 3184 GetFrameTree()->root(); | |
| 3185 | 3118 |
| 3186 TestNavigationObserver observer(shell()->web_contents()); | 3119 TestNavigationObserver observer(shell()->web_contents()); |
| 3187 | 3120 |
| 3188 // Load same-site page into iframe. | 3121 // Load same-site page into iframe. |
| 3189 FrameTreeNode* child = root->child_at(0); | 3122 FrameTreeNode* child = root->child_at(0); |
| 3190 GURL http_url(embedded_test_server()->GetURL("/title1.html")); | 3123 GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
| 3191 NavigateFrameToURL(child, http_url); | 3124 NavigateFrameToURL(child, http_url); |
| 3192 EXPECT_EQ(http_url, observer.last_navigation_url()); | 3125 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 3193 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3126 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3194 | 3127 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3208 | 3141 |
| 3209 // Ensure that the renderer does not crash when navigating a frame that has a | 3142 // Ensure that the renderer does not crash when navigating a frame that has a |
| 3210 // sibling RemoteFrame. See https://crbug.com/426953. | 3143 // sibling RemoteFrame. See https://crbug.com/426953. |
| 3211 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3144 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3212 NavigateWithSiblingRemoteFrame) { | 3145 NavigateWithSiblingRemoteFrame) { |
| 3213 GURL main_url( | 3146 GURL main_url( |
| 3214 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 3147 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 3215 NavigateToURL(shell(), main_url); | 3148 NavigateToURL(shell(), main_url); |
| 3216 | 3149 |
| 3217 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3150 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3218 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3151 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3219 ->GetFrameTree() | |
| 3220 ->root(); | |
| 3221 TestNavigationObserver observer(shell()->web_contents()); | 3152 TestNavigationObserver observer(shell()->web_contents()); |
| 3222 | 3153 |
| 3223 // Make sure the first frame is out of process. | 3154 // Make sure the first frame is out of process. |
| 3224 ASSERT_EQ(2U, root->child_count()); | 3155 ASSERT_EQ(2U, root->child_count()); |
| 3225 FrameTreeNode* node2 = root->child_at(0); | 3156 FrameTreeNode* node2 = root->child_at(0); |
| 3226 EXPECT_NE(root->current_frame_host()->GetSiteInstance(), | 3157 EXPECT_NE(root->current_frame_host()->GetSiteInstance(), |
| 3227 node2->current_frame_host()->GetSiteInstance()); | 3158 node2->current_frame_host()->GetSiteInstance()); |
| 3228 | 3159 |
| 3229 // Make sure the second frame is in the parent's process. | 3160 // Make sure the second frame is in the parent's process. |
| 3230 FrameTreeNode* node3 = root->child_at(1); | 3161 FrameTreeNode* node3 = root->child_at(1); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 3244 // Ensure that the renderer does not crash when a local frame with a remote | 3175 // Ensure that the renderer does not crash when a local frame with a remote |
| 3245 // parent frame is swapped from local to remote, then back to local again. | 3176 // parent frame is swapped from local to remote, then back to local again. |
| 3246 // See https://crbug.com/585654. | 3177 // See https://crbug.com/585654. |
| 3247 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3178 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3248 NavigateSiblingsToSameProcess) { | 3179 NavigateSiblingsToSameProcess) { |
| 3249 GURL main_url( | 3180 GURL main_url( |
| 3250 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); | 3181 embedded_test_server()->GetURL("/frame_tree/page_with_two_frames.html")); |
| 3251 NavigateToURL(shell(), main_url); | 3182 NavigateToURL(shell(), main_url); |
| 3252 | 3183 |
| 3253 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3184 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3254 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3185 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3255 ->GetFrameTree() | |
| 3256 ->root(); | |
| 3257 | 3186 |
| 3258 FrameTreeNode* node2 = root->child_at(0); | 3187 FrameTreeNode* node2 = root->child_at(0); |
| 3259 FrameTreeNode* node3 = root->child_at(1); | 3188 FrameTreeNode* node3 = root->child_at(1); |
| 3260 | 3189 |
| 3261 // Navigate the second iframe to the same process as the first. | 3190 // Navigate the second iframe to the same process as the first. |
| 3262 GURL frame_url = embedded_test_server()->GetURL("bar.com", "/title1.html"); | 3191 GURL frame_url = embedded_test_server()->GetURL("bar.com", "/title1.html"); |
| 3263 NavigateFrameToURL(node3, frame_url); | 3192 NavigateFrameToURL(node3, frame_url); |
| 3264 | 3193 |
| 3265 // Verify that they are in the same process. | 3194 // Verify that they are in the same process. |
| 3266 EXPECT_EQ(node2->current_frame_host()->GetSiteInstance(), | 3195 EXPECT_EQ(node2->current_frame_host()->GetSiteInstance(), |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 3291 { | 3220 { |
| 3292 GURL main_url( | 3221 GURL main_url( |
| 3293 embedded_test_server()->GetURL("/frame_with_load_event.html")); | 3222 embedded_test_server()->GetURL("/frame_with_load_event.html")); |
| 3294 base::string16 expected_title(base::UTF8ToUTF16("LOADED")); | 3223 base::string16 expected_title(base::UTF8ToUTF16("LOADED")); |
| 3295 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 3224 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 3296 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3225 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3297 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); | 3226 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); |
| 3298 } | 3227 } |
| 3299 | 3228 |
| 3300 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3229 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3301 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3230 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3302 ->GetFrameTree() | |
| 3303 ->root(); | |
| 3304 | 3231 |
| 3305 // Load another cross-site page into the iframe and check that the load event | 3232 // Load another cross-site page into the iframe and check that the load event |
| 3306 // is fired. | 3233 // is fired. |
| 3307 { | 3234 { |
| 3308 GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); | 3235 GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); |
| 3309 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED")); | 3236 base::string16 expected_title(base::UTF8ToUTF16("LOADEDLOADED")); |
| 3310 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 3237 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 3311 TestNavigationObserver observer(shell()->web_contents()); | 3238 TestNavigationObserver observer(shell()->web_contents()); |
| 3312 NavigateFrameToURL(root->child_at(0), foo_url); | 3239 NavigateFrameToURL(root->child_at(0), foo_url); |
| 3313 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3240 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3314 EXPECT_EQ(foo_url, observer.last_navigation_url()); | 3241 EXPECT_EQ(foo_url, observer.last_navigation_url()); |
| 3315 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); | 3242 EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); |
| 3316 } | 3243 } |
| 3317 } | 3244 } |
| 3318 | 3245 |
| 3319 // Check that postMessage can be routed between cross-site iframes. | 3246 // Check that postMessage can be routed between cross-site iframes. |
| 3320 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframePostMessage) { | 3247 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframePostMessage) { |
| 3321 GURL main_url(embedded_test_server()->GetURL( | 3248 GURL main_url(embedded_test_server()->GetURL( |
| 3322 "/frame_tree/page_with_post_message_frames.html")); | 3249 "/frame_tree/page_with_post_message_frames.html")); |
| 3323 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3250 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3324 | 3251 |
| 3325 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3252 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3326 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3253 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3327 ->GetFrameTree() | |
| 3328 ->root(); | |
| 3329 | 3254 |
| 3330 ASSERT_EQ(2U, root->child_count()); | 3255 ASSERT_EQ(2U, root->child_count()); |
| 3331 | 3256 |
| 3332 // Verify the frames start at correct URLs. First frame should be | 3257 // Verify the frames start at correct URLs. First frame should be |
| 3333 // same-site; second frame should be cross-site. | 3258 // same-site; second frame should be cross-site. |
| 3334 GURL same_site_url(embedded_test_server()->GetURL("/post_message.html")); | 3259 GURL same_site_url(embedded_test_server()->GetURL("/post_message.html")); |
| 3335 EXPECT_EQ(same_site_url, root->child_at(0)->current_url()); | 3260 EXPECT_EQ(same_site_url, root->child_at(0)->current_url()); |
| 3336 GURL foo_url(embedded_test_server()->GetURL("foo.com", | 3261 GURL foo_url(embedded_test_server()->GetURL("foo.com", |
| 3337 "/post_message.html")); | 3262 "/post_message.html")); |
| 3338 EXPECT_EQ(foo_url, root->child_at(1)->current_url()); | 3263 EXPECT_EQ(foo_url, root->child_at(1)->current_url()); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 3364 | 3289 |
| 3365 // Check that postMessage can be sent from a subframe on a cross-process opener | 3290 // Check that postMessage can be sent from a subframe on a cross-process opener |
| 3366 // tab, and that its event.source points to a valid proxy. | 3291 // tab, and that its event.source points to a valid proxy. |
| 3367 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3292 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3368 PostMessageWithSubframeOnOpenerChain) { | 3293 PostMessageWithSubframeOnOpenerChain) { |
| 3369 GURL main_url(embedded_test_server()->GetURL( | 3294 GURL main_url(embedded_test_server()->GetURL( |
| 3370 "a.com", "/frame_tree/page_with_post_message_frames.html")); | 3295 "a.com", "/frame_tree/page_with_post_message_frames.html")); |
| 3371 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3296 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3372 | 3297 |
| 3373 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3298 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3374 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3299 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3375 ->GetFrameTree() | |
| 3376 ->root(); | |
| 3377 | 3300 |
| 3378 ASSERT_EQ(2U, root->child_count()); | 3301 ASSERT_EQ(2U, root->child_count()); |
| 3379 | 3302 |
| 3380 // Verify the initial state of the world. First frame should be same-site; | 3303 // Verify the initial state of the world. First frame should be same-site; |
| 3381 // second frame should be cross-site. | 3304 // second frame should be cross-site. |
| 3382 EXPECT_EQ( | 3305 EXPECT_EQ( |
| 3383 " Site A ------------ proxies for B\n" | 3306 " Site A ------------ proxies for B\n" |
| 3384 " |--Site A ------- proxies for B\n" | 3307 " |--Site A ------- proxies for B\n" |
| 3385 " +--Site B ------- proxies for A\n" | 3308 " +--Site B ------- proxies for A\n" |
| 3386 "Where A = http://a.com/\n" | 3309 "Where A = http://a.com/\n" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3475 | 3398 |
| 3476 // Check that parent.frames[num] references correct sibling frames when the | 3399 // Check that parent.frames[num] references correct sibling frames when the |
| 3477 // parent is remote. See https://crbug.com/478792. | 3400 // parent is remote. See https://crbug.com/478792. |
| 3478 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, IndexedFrameAccess) { | 3401 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, IndexedFrameAccess) { |
| 3479 // Start on a page with three same-site subframes. | 3402 // Start on a page with three same-site subframes. |
| 3480 GURL main_url( | 3403 GURL main_url( |
| 3481 embedded_test_server()->GetURL("a.com", "/frame_tree/top.html")); | 3404 embedded_test_server()->GetURL("a.com", "/frame_tree/top.html")); |
| 3482 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3405 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3483 | 3406 |
| 3484 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3407 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3485 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3408 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3486 ->GetFrameTree() | |
| 3487 ->root(); | |
| 3488 ASSERT_EQ(3U, root->child_count()); | 3409 ASSERT_EQ(3U, root->child_count()); |
| 3489 FrameTreeNode* child0 = root->child_at(0); | 3410 FrameTreeNode* child0 = root->child_at(0); |
| 3490 FrameTreeNode* child1 = root->child_at(1); | 3411 FrameTreeNode* child1 = root->child_at(1); |
| 3491 FrameTreeNode* child2 = root->child_at(2); | 3412 FrameTreeNode* child2 = root->child_at(2); |
| 3492 | 3413 |
| 3493 // Send each of the frames to a different site. Each new renderer will first | 3414 // Send each of the frames to a different site. Each new renderer will first |
| 3494 // create proxies for the parent and two sibling subframes and then create | 3415 // create proxies for the parent and two sibling subframes and then create |
| 3495 // and insert the new RenderFrame into the frame tree. | 3416 // and insert the new RenderFrame into the frame tree. |
| 3496 GURL b_url(embedded_test_server()->GetURL("b.com", "/post_message.html")); | 3417 GURL b_url(embedded_test_server()->GetURL("b.com", "/post_message.html")); |
| 3497 GURL c_url(embedded_test_server()->GetURL("c.com", "/post_message.html")); | 3418 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... | |
| 3547 EXPECT_EQ(1, GetReceivedMessages(child0)); | 3468 EXPECT_EQ(1, GetReceivedMessages(child0)); |
| 3548 EXPECT_EQ(2, GetReceivedMessages(child1)); | 3469 EXPECT_EQ(2, GetReceivedMessages(child1)); |
| 3549 EXPECT_EQ(1, GetReceivedMessages(child2)); | 3470 EXPECT_EQ(1, GetReceivedMessages(child2)); |
| 3550 } | 3471 } |
| 3551 | 3472 |
| 3552 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RFPHDestruction) { | 3473 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RFPHDestruction) { |
| 3553 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 3474 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 3554 NavigateToURL(shell(), main_url); | 3475 NavigateToURL(shell(), main_url); |
| 3555 | 3476 |
| 3556 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3477 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3557 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3478 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3558 ->GetFrameTree() | |
| 3559 ->root(); | |
| 3560 | 3479 |
| 3561 TestNavigationObserver observer(shell()->web_contents()); | 3480 TestNavigationObserver observer(shell()->web_contents()); |
| 3562 | 3481 |
| 3563 // Load cross-site page into iframe. | 3482 // Load cross-site page into iframe. |
| 3564 FrameTreeNode* child = root->child_at(0); | 3483 FrameTreeNode* child = root->child_at(0); |
| 3565 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | 3484 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 3566 NavigateFrameToURL(root->child_at(0), url); | 3485 NavigateFrameToURL(root->child_at(0), url); |
| 3567 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3486 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 3568 EXPECT_EQ(url, observer.last_navigation_url()); | 3487 EXPECT_EQ(url, observer.last_navigation_url()); |
| 3569 EXPECT_EQ( | 3488 EXPECT_EQ( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3608 "Where A = http://127.0.0.1/", | 3527 "Where A = http://127.0.0.1/", |
| 3609 DepictFrameTree(root)); | 3528 DepictFrameTree(root)); |
| 3610 } | 3529 } |
| 3611 | 3530 |
| 3612 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) { | 3531 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) { |
| 3613 GURL main_url( | 3532 GURL main_url( |
| 3614 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | 3533 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); |
| 3615 NavigateToURL(shell(), main_url); | 3534 NavigateToURL(shell(), main_url); |
| 3616 | 3535 |
| 3617 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3536 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3618 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3537 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3619 ->GetFrameTree() | |
| 3620 ->root(); | |
| 3621 | 3538 |
| 3622 // Navigate first child cross-site. | 3539 // Navigate first child cross-site. |
| 3623 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 3540 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 3624 NavigateFrameToURL(root->child_at(0), frame_url); | 3541 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3625 | 3542 |
| 3626 // Open a popup from the first child. | 3543 // Open a popup from the first child. |
| 3627 Shell* new_shell = OpenPopup(root->child_at(0)->current_frame_host(), | 3544 Shell* new_shell = OpenPopup(root->child_at(0)->current_frame_host(), |
| 3628 GURL(url::kAboutBlankURL), ""); | 3545 GURL(url::kAboutBlankURL), ""); |
| 3629 EXPECT_TRUE(new_shell); | 3546 EXPECT_TRUE(new_shell); |
| 3630 | 3547 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3712 | 3629 |
| 3713 // Verify that named frames are discoverable from their opener's ancestors. | 3630 // Verify that named frames are discoverable from their opener's ancestors. |
| 3714 // See https://crbug.com/511474. | 3631 // See https://crbug.com/511474. |
| 3715 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3632 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3716 DiscoverNamedFrameFromAncestorOfOpener) { | 3633 DiscoverNamedFrameFromAncestorOfOpener) { |
| 3717 GURL main_url( | 3634 GURL main_url( |
| 3718 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | 3635 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); |
| 3719 NavigateToURL(shell(), main_url); | 3636 NavigateToURL(shell(), main_url); |
| 3720 | 3637 |
| 3721 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3638 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3722 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3639 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3723 ->GetFrameTree() | |
| 3724 ->root(); | |
| 3725 | 3640 |
| 3726 // Navigate first child cross-site. | 3641 // Navigate first child cross-site. |
| 3727 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 3642 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 3728 NavigateFrameToURL(root->child_at(0), frame_url); | 3643 NavigateFrameToURL(root->child_at(0), frame_url); |
| 3729 | 3644 |
| 3730 // Open a popup named "foo" from the first child. | 3645 // Open a popup named "foo" from the first child. |
| 3731 Shell* foo_shell = OpenPopup(root->child_at(0)->current_frame_host(), | 3646 Shell* foo_shell = OpenPopup(root->child_at(0)->current_frame_host(), |
| 3732 GURL(url::kAboutBlankURL), "foo"); | 3647 GURL(url::kAboutBlankURL), "foo"); |
| 3733 EXPECT_TRUE(foo_shell); | 3648 EXPECT_TRUE(foo_shell); |
| 3734 | 3649 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3765 // still be discoverable from its opener's ancestors. Also, instead of using | 3680 // still be discoverable from its opener's ancestors. Also, instead of using |
| 3766 // an opener's ancestor, this test uses a popup with same origin as that | 3681 // an opener's ancestor, this test uses a popup with same origin as that |
| 3767 // ancestor. See https://crbug.com/511474. | 3682 // ancestor. See https://crbug.com/511474. |
| 3768 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3683 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3769 DiscoverFrameAfterSettingWindowName) { | 3684 DiscoverFrameAfterSettingWindowName) { |
| 3770 GURL main_url( | 3685 GURL main_url( |
| 3771 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); | 3686 embedded_test_server()->GetURL("a.com", "/site_per_process_main.html")); |
| 3772 NavigateToURL(shell(), main_url); | 3687 NavigateToURL(shell(), main_url); |
| 3773 | 3688 |
| 3774 // It is safe to obtain the root frame tree node here, as it doesn't change. | 3689 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 3775 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3690 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3776 ->GetFrameTree() | |
| 3777 ->root(); | |
| 3778 | 3691 |
| 3779 // Open a same-site popup from the main frame. | 3692 // Open a same-site popup from the main frame. |
| 3780 GURL a_com_url(embedded_test_server()->GetURL("a.com", "/title3.html")); | 3693 GURL a_com_url(embedded_test_server()->GetURL("a.com", "/title3.html")); |
| 3781 Shell* a_com_shell = | 3694 Shell* a_com_shell = |
| 3782 OpenPopup(root->child_at(0)->current_frame_host(), a_com_url, ""); | 3695 OpenPopup(root->child_at(0)->current_frame_host(), a_com_url, ""); |
| 3783 EXPECT_TRUE(a_com_shell); | 3696 EXPECT_TRUE(a_com_shell); |
| 3784 | 3697 |
| 3785 // Navigate first child on main frame cross-site. | 3698 // Navigate first child on main frame cross-site. |
| 3786 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); | 3699 GURL frame_url(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 3787 NavigateFrameToURL(root->child_at(0), frame_url); | 3700 NavigateFrameToURL(root->child_at(0), frame_url); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3825 // ^ | | 3738 // ^ | |
| 3826 // +--------------------+ | 3739 // +--------------------+ |
| 3827 // | 3740 // |
| 3828 // The sites are carefully set up so that both opener updates are cross-process | 3741 // The sites are carefully set up so that both opener updates are cross-process |
| 3829 // but still allowed by Blink's navigation checks. | 3742 // but still allowed by Blink's navigation checks. |
| 3830 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, UpdateSubframeOpener) { | 3743 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, UpdateSubframeOpener) { |
| 3831 GURL main_url = embedded_test_server()->GetURL( | 3744 GURL main_url = embedded_test_server()->GetURL( |
| 3832 "foo.com", "/frame_tree/page_with_two_frames.html"); | 3745 "foo.com", "/frame_tree/page_with_two_frames.html"); |
| 3833 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3746 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3834 | 3747 |
| 3835 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3748 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3836 ->GetFrameTree() | |
| 3837 ->root(); | |
| 3838 EXPECT_EQ(2U, root->child_count()); | 3749 EXPECT_EQ(2U, root->child_count()); |
| 3839 | 3750 |
| 3840 // From the top frame, open a popup and navigate it to a cross-site page with | 3751 // From the top frame, open a popup and navigate it to a cross-site page with |
| 3841 // two subframes. | 3752 // two subframes. |
| 3842 Shell* popup_shell = | 3753 Shell* popup_shell = |
| 3843 OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "popup"); | 3754 OpenPopup(shell()->web_contents(), GURL(url::kAboutBlankURL), "popup"); |
| 3844 EXPECT_TRUE(popup_shell); | 3755 EXPECT_TRUE(popup_shell); |
| 3845 GURL popup_url(embedded_test_server()->GetURL( | 3756 GURL popup_url(embedded_test_server()->GetURL( |
| 3846 "bar.com", "/frame_tree/page_with_post_message_frames.html")); | 3757 "bar.com", "/frame_tree/page_with_post_message_frames.html")); |
| 3847 NavigateToURL(popup_shell, popup_url); | 3758 NavigateToURL(popup_shell, popup_url); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3900 | 3811 |
| 3901 // Check that when a subframe navigates to a new SiteInstance, the new | 3812 // Check that when a subframe navigates to a new SiteInstance, the new |
| 3902 // SiteInstance will get a proxy for the opener of subframe's parent. I.e., | 3813 // SiteInstance will get a proxy for the opener of subframe's parent. I.e., |
| 3903 // accessing parent.opener from the subframe should still work after a | 3814 // accessing parent.opener from the subframe should still work after a |
| 3904 // cross-process navigation. | 3815 // cross-process navigation. |
| 3905 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3816 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 3906 NavigatingSubframePreservesOpenerInParent) { | 3817 NavigatingSubframePreservesOpenerInParent) { |
| 3907 GURL main_url = embedded_test_server()->GetURL("a.com", "/post_message.html"); | 3818 GURL main_url = embedded_test_server()->GetURL("a.com", "/post_message.html"); |
| 3908 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3819 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3909 | 3820 |
| 3910 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3821 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3911 ->GetFrameTree() | |
| 3912 ->root(); | |
| 3913 | 3822 |
| 3914 // Open a popup with a cross-site page that has a subframe. | 3823 // Open a popup with a cross-site page that has a subframe. |
| 3915 GURL popup_url(embedded_test_server()->GetURL( | 3824 GURL popup_url(embedded_test_server()->GetURL( |
| 3916 "b.com", "/cross_site_iframe_factory.html?b(b)")); | 3825 "b.com", "/cross_site_iframe_factory.html?b(b)")); |
| 3917 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); | 3826 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); |
| 3918 EXPECT_TRUE(popup_shell); | 3827 EXPECT_TRUE(popup_shell); |
| 3919 FrameTreeNode* popup_root = | 3828 FrameTreeNode* popup_root = |
| 3920 static_cast<WebContentsImpl*>(popup_shell->web_contents()) | 3829 static_cast<WebContentsImpl*>(popup_shell->web_contents()) |
| 3921 ->GetFrameTree() | 3830 ->GetFrameTree() |
| 3922 ->root(); | 3831 ->root(); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 3947 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 3856 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 3948 } | 3857 } |
| 3949 | 3858 |
| 3950 // Check that if a subframe has an opener, that opener is preserved when the | 3859 // Check that if a subframe has an opener, that opener is preserved when the |
| 3951 // subframe navigates cross-site. | 3860 // subframe navigates cross-site. |
| 3952 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateSubframeWithOpener) { | 3861 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateSubframeWithOpener) { |
| 3953 GURL main_url(embedded_test_server()->GetURL( | 3862 GURL main_url(embedded_test_server()->GetURL( |
| 3954 "foo.com", "/frame_tree/page_with_two_frames.html")); | 3863 "foo.com", "/frame_tree/page_with_two_frames.html")); |
| 3955 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3864 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 3956 | 3865 |
| 3957 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3866 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 3958 ->GetFrameTree() | |
| 3959 ->root(); | |
| 3960 EXPECT_EQ( | 3867 EXPECT_EQ( |
| 3961 " Site A ------------ proxies for B\n" | 3868 " Site A ------------ proxies for B\n" |
| 3962 " |--Site B ------- proxies for A\n" | 3869 " |--Site B ------- proxies for A\n" |
| 3963 " +--Site A ------- proxies for B\n" | 3870 " +--Site A ------- proxies for B\n" |
| 3964 "Where A = http://foo.com/\n" | 3871 "Where A = http://foo.com/\n" |
| 3965 " B = http://bar.com/", | 3872 " B = http://bar.com/", |
| 3966 DepictFrameTree(root)); | 3873 DepictFrameTree(root)); |
| 3967 | 3874 |
| 3968 // Update the first (cross-site) subframe's opener to root frame. | 3875 // Update the first (cross-site) subframe's opener to root frame. |
| 3969 bool success = false; | 3876 bool success = false; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4014 // RenderFrameProxy is created for that subframe in another renderer process. | 3921 // RenderFrameProxy is created for that subframe in another renderer process. |
| 4015 // Similar to NavigateSubframeWithOpener, but this test verifies the subframe | 3922 // Similar to NavigateSubframeWithOpener, but this test verifies the subframe |
| 4016 // opener plumbing for FrameMsg_NewFrameProxy, whereas | 3923 // opener plumbing for FrameMsg_NewFrameProxy, whereas |
| 4017 // NavigateSubframeWithOpener targets FrameMsg_NewFrame. | 3924 // NavigateSubframeWithOpener targets FrameMsg_NewFrame. |
| 4018 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 3925 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4019 NewRenderFrameProxyPreservesOpener) { | 3926 NewRenderFrameProxyPreservesOpener) { |
| 4020 GURL main_url( | 3927 GURL main_url( |
| 4021 embedded_test_server()->GetURL("foo.com", "/post_message.html")); | 3928 embedded_test_server()->GetURL("foo.com", "/post_message.html")); |
| 4022 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 3929 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4023 | 3930 |
| 4024 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 3931 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4025 ->GetFrameTree() | |
| 4026 ->root(); | |
| 4027 | 3932 |
| 4028 // Open a popup with a cross-site page that has two subframes. | 3933 // Open a popup with a cross-site page that has two subframes. |
| 4029 GURL popup_url(embedded_test_server()->GetURL( | 3934 GURL popup_url(embedded_test_server()->GetURL( |
| 4030 "bar.com", "/frame_tree/page_with_post_message_frames.html")); | 3935 "bar.com", "/frame_tree/page_with_post_message_frames.html")); |
| 4031 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); | 3936 Shell* popup_shell = OpenPopup(shell()->web_contents(), popup_url, "popup"); |
| 4032 EXPECT_TRUE(popup_shell); | 3937 EXPECT_TRUE(popup_shell); |
| 4033 FrameTreeNode* popup_root = | 3938 FrameTreeNode* popup_root = |
| 4034 static_cast<WebContentsImpl*>(popup_shell->web_contents()) | 3939 static_cast<WebContentsImpl*>(popup_shell->web_contents()) |
| 4035 ->GetFrameTree() | 3940 ->GetFrameTree() |
| 4036 ->root(); | 3941 ->root(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4093 | 3998 |
| 4094 // Test for https://crbug.com/515302. Perform two navigations, A->B->A, and | 3999 // Test for https://crbug.com/515302. Perform two navigations, A->B->A, and |
| 4095 // delay the SwapOut ACK from the A->B navigation, so that the second B->A | 4000 // delay the SwapOut ACK from the A->B navigation, so that the second B->A |
| 4096 // navigation is initiated before the first page receives the SwapOut ACK. | 4001 // navigation is initiated before the first page receives the SwapOut ACK. |
| 4097 // Ensure that the RVH(A) that's pending deletion is not reused in that case. | 4002 // Ensure that the RVH(A) that's pending deletion is not reused in that case. |
| 4098 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4003 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4099 RenderViewHostPendingDeletionIsNotReused) { | 4004 RenderViewHostPendingDeletionIsNotReused) { |
| 4100 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 4005 GURL a_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 4101 NavigateToURL(shell(), a_url); | 4006 NavigateToURL(shell(), a_url); |
| 4102 | 4007 |
| 4103 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4008 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4104 ->GetFrameTree() | |
| 4105 ->root(); | |
| 4106 RenderFrameHostImpl* rfh = root->current_frame_host(); | 4009 RenderFrameHostImpl* rfh = root->current_frame_host(); |
| 4107 RenderViewHostImpl* rvh = rfh->render_view_host(); | 4010 RenderViewHostImpl* rvh = rfh->render_view_host(); |
| 4108 int rvh_routing_id = rvh->GetRoutingID(); | 4011 int rvh_routing_id = rvh->GetRoutingID(); |
| 4109 SiteInstanceImpl* site_instance = rfh->GetSiteInstance(); | 4012 SiteInstanceImpl* site_instance = rfh->GetSiteInstance(); |
| 4110 RenderFrameDeletedObserver deleted_observer(rfh); | 4013 RenderFrameDeletedObserver deleted_observer(rfh); |
| 4111 | 4014 |
| 4112 // Install a BrowserMessageFilter to drop SwapOut ACK messages in A's | 4015 // Install a BrowserMessageFilter to drop SwapOut ACK messages in A's |
| 4113 // process. | 4016 // process. |
| 4114 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter(); | 4017 scoped_refptr<SwapoutACKMessageFilter> filter = new SwapoutACKMessageFilter(); |
| 4115 rfh->GetProcess()->AddFilter(filter.get()); | 4018 rfh->GetProcess()->AddFilter(filter.get()); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4187 // Check that when a cross-process frame acquires focus, the old focused frame | 4090 // Check that when a cross-process frame acquires focus, the old focused frame |
| 4188 // loses focus and fires blur events. Starting on a page with a cross-site | 4091 // loses focus and fires blur events. Starting on a page with a cross-site |
| 4189 // subframe, simulate mouse clicks to switch focus from root frame to subframe | 4092 // subframe, simulate mouse clicks to switch focus from root frame to subframe |
| 4190 // and then back to root frame. | 4093 // and then back to root frame. |
| 4191 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4094 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4192 CrossProcessFocusChangeFiresBlurEvents) { | 4095 CrossProcessFocusChangeFiresBlurEvents) { |
| 4193 GURL main_url( | 4096 GURL main_url( |
| 4194 embedded_test_server()->GetURL("a.com", "/page_with_input_field.html")); | 4097 embedded_test_server()->GetURL("a.com", "/page_with_input_field.html")); |
| 4195 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4098 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4196 | 4099 |
| 4197 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4100 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4198 ->GetFrameTree() | |
| 4199 ->root(); | |
| 4200 | 4101 |
| 4201 EXPECT_EQ( | 4102 EXPECT_EQ( |
| 4202 " Site A ------------ proxies for B\n" | 4103 " Site A ------------ proxies for B\n" |
| 4203 " +--Site B ------- proxies for A\n" | 4104 " +--Site B ------- proxies for A\n" |
| 4204 "Where A = http://a.com/\n" | 4105 "Where A = http://a.com/\n" |
| 4205 " B = http://b.com/", | 4106 " B = http://b.com/", |
| 4206 DepictFrameTree(root)); | 4107 DepictFrameTree(root)); |
| 4207 | 4108 |
| 4208 // Focus the main frame's text field. The return value "input-focus" | 4109 // Focus the main frame's text field. The return value "input-focus" |
| 4209 // indicates that the focus event was fired correctly. | 4110 // indicates that the focus event was fired correctly. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4249 | 4150 |
| 4250 // Check that when a cross-process subframe is focused, its parent's | 4151 // Check that when a cross-process subframe is focused, its parent's |
| 4251 // document.activeElement correctly returns the corresponding <iframe> element. | 4152 // document.activeElement correctly returns the corresponding <iframe> element. |
| 4252 // The test sets up an A-embed-B-embed-C page and shifts focus A->B->A->C, | 4153 // The test sets up an A-embed-B-embed-C page and shifts focus A->B->A->C, |
| 4253 // checking document.activeElement after each change. | 4154 // checking document.activeElement after each change. |
| 4254 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DocumentActiveElement) { | 4155 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DocumentActiveElement) { |
| 4255 GURL main_url(embedded_test_server()->GetURL( | 4156 GURL main_url(embedded_test_server()->GetURL( |
| 4256 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); | 4157 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); |
| 4257 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4158 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4258 | 4159 |
| 4259 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4160 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4260 ->GetFrameTree() | |
| 4261 ->root(); | |
| 4262 | 4161 |
| 4263 EXPECT_EQ( | 4162 EXPECT_EQ( |
| 4264 " Site A ------------ proxies for B C\n" | 4163 " Site A ------------ proxies for B C\n" |
| 4265 " +--Site B ------- proxies for A C\n" | 4164 " +--Site B ------- proxies for A C\n" |
| 4266 " +--Site C -- proxies for A B\n" | 4165 " +--Site C -- proxies for A B\n" |
| 4267 "Where A = http://a.com/\n" | 4166 "Where A = http://a.com/\n" |
| 4268 " B = http://b.com/\n" | 4167 " B = http://b.com/\n" |
| 4269 " C = http://c.com/", | 4168 " C = http://c.com/", |
| 4270 DepictFrameTree(root)); | 4169 DepictFrameTree(root)); |
| 4271 | 4170 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4323 verify_active_element_property(child_rfh, "src", | 4222 verify_active_element_property(child_rfh, "src", |
| 4324 grandchild->current_url().spec()); | 4223 grandchild->current_url().spec()); |
| 4325 } | 4224 } |
| 4326 | 4225 |
| 4327 // Check that window.focus works for cross-process subframes. | 4226 // Check that window.focus works for cross-process subframes. |
| 4328 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframeWindowFocus) { | 4227 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframeWindowFocus) { |
| 4329 GURL main_url(embedded_test_server()->GetURL( | 4228 GURL main_url(embedded_test_server()->GetURL( |
| 4330 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); | 4229 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); |
| 4331 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4230 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4332 | 4231 |
| 4333 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4232 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4334 ->GetFrameTree() | |
| 4335 ->root(); | |
| 4336 | 4233 |
| 4337 EXPECT_EQ( | 4234 EXPECT_EQ( |
| 4338 " Site A ------------ proxies for B C\n" | 4235 " Site A ------------ proxies for B C\n" |
| 4339 " |--Site B ------- proxies for A C\n" | 4236 " |--Site B ------- proxies for A C\n" |
| 4340 " +--Site C ------- proxies for A B\n" | 4237 " +--Site C ------- proxies for A B\n" |
| 4341 "Where A = http://a.com/\n" | 4238 "Where A = http://a.com/\n" |
| 4342 " B = http://b.com/\n" | 4239 " B = http://b.com/\n" |
| 4343 " C = http://c.com/", | 4240 " C = http://c.com/", |
| 4344 DepictFrameTree(root)); | 4241 DepictFrameTree(root)); |
| 4345 | 4242 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4462 | 4359 |
| 4463 // Verify that we receive a mouse cursor update message when we mouse over | 4360 // Verify that we receive a mouse cursor update message when we mouse over |
| 4464 // a text field contained in an out-of-process iframe. | 4361 // a text field contained in an out-of-process iframe. |
| 4465 // Fails under TSan. http://crbug.com/545237 | 4362 // Fails under TSan. http://crbug.com/545237 |
| 4466 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4363 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4467 DISABLED_CursorUpdateFromReceivedFromCrossSiteIframe) { | 4364 DISABLED_CursorUpdateFromReceivedFromCrossSiteIframe) { |
| 4468 GURL main_url(embedded_test_server()->GetURL( | 4365 GURL main_url(embedded_test_server()->GetURL( |
| 4469 "/frame_tree/page_with_positioned_frame.html")); | 4366 "/frame_tree/page_with_positioned_frame.html")); |
| 4470 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4367 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4471 | 4368 |
| 4472 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4369 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4473 ->GetFrameTree() | |
| 4474 ->root(); | |
| 4475 | 4370 |
| 4476 FrameTreeNode* child_node = root->child_at(0); | 4371 FrameTreeNode* child_node = root->child_at(0); |
| 4477 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | 4372 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), |
| 4478 child_node->current_frame_host()->GetSiteInstance()); | 4373 child_node->current_frame_host()->GetSiteInstance()); |
| 4479 | 4374 |
| 4480 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); | 4375 scoped_refptr<CursorMessageFilter> filter = new CursorMessageFilter(); |
| 4481 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); | 4376 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); |
| 4482 | 4377 |
| 4483 // Send a MouseMove to the subframe. The frame contains text, and moving the | 4378 // Send a MouseMove to the subframe. The frame contains text, and moving the |
| 4484 // mouse over it should cause the renderer to send a mouse cursor update. | 4379 // mouse over it should cause the renderer to send a mouse cursor update. |
| 4485 blink::WebMouseEvent mouse_event; | 4380 blink::WebMouseEvent mouse_event; |
| 4486 mouse_event.type = blink::WebInputEvent::MouseMove; | 4381 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 4487 mouse_event.x = 60; | 4382 mouse_event.x = 60; |
| 4488 mouse_event.y = 60; | 4383 mouse_event.y = 60; |
| 4489 RenderWidgetHost* rwh_child = | 4384 RenderWidgetHost* rwh_child = |
| 4490 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 4385 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 4491 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 4386 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 4492 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4387 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 4493 static_cast<WebContentsImpl*>(shell()->web_contents()) | 4388 web_contents()->GetInputEventRouter()->RouteMouseEvent(root_view, |
| 4494 ->GetInputEventRouter() | 4389 &mouse_event); |
| 4495 ->RouteMouseEvent(root_view, &mouse_event); | |
| 4496 | 4390 |
| 4497 // CursorMessageFilter::Wait() implicitly tests whether we receive a | 4391 // CursorMessageFilter::Wait() implicitly tests whether we receive a |
| 4498 // ViewHostMsg_SetCursor message from the renderer process, because it does | 4392 // ViewHostMsg_SetCursor message from the renderer process, because it does |
| 4499 // does not return otherwise. | 4393 // does not return otherwise. |
| 4500 filter->Wait(); | 4394 filter->Wait(); |
| 4501 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); | 4395 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); |
| 4502 } | 4396 } |
| 4503 #endif | 4397 #endif |
| 4504 | 4398 |
| 4505 // Tests that we are using the correct RenderFrameProxy when navigating an | 4399 // Tests that we are using the correct RenderFrameProxy when navigating an |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 4528 #if defined(USE_AURA) | 4422 #if defined(USE_AURA) |
| 4529 // Browser process hit testing is not implemented on Android, and this test | 4423 // Browser process hit testing is not implemented on Android, and this test |
| 4530 // requires Aura for RenderWidgetHostViewAura::OnTouchEvent(). | 4424 // requires Aura for RenderWidgetHostViewAura::OnTouchEvent(). |
| 4531 // https://crbug.com/491334 | 4425 // https://crbug.com/491334 |
| 4532 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4426 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4533 SubframeTouchEventRouting) { | 4427 SubframeTouchEventRouting) { |
| 4534 GURL main_url(embedded_test_server()->GetURL( | 4428 GURL main_url(embedded_test_server()->GetURL( |
| 4535 "/frame_tree/page_with_positioned_nested_frames.html")); | 4429 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 4536 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4430 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4537 | 4431 |
| 4538 WebContentsImpl* web_contents = | 4432 WebContentsImpl* contents = web_contents(); |
|
Charlie Reis
2016/04/15 05:25:56
nit: This doesn't seem necessary. Just call web_c
| |
| 4539 static_cast<WebContentsImpl*>(shell()->web_contents()); | 4433 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 4540 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4541 ASSERT_EQ(1U, root->child_count()); | 4434 ASSERT_EQ(1U, root->child_count()); |
| 4542 | 4435 |
| 4543 GURL frame_url( | 4436 GURL frame_url( |
| 4544 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html")); | 4437 embedded_test_server()->GetURL("b.com", "/page_with_touch_handler.html")); |
| 4545 NavigateFrameToURL(root->child_at(0), frame_url); | 4438 NavigateFrameToURL(root->child_at(0), frame_url); |
| 4546 | 4439 |
| 4547 // Synchronize with the child and parent renderers to guarantee that the | 4440 // Synchronize with the child and parent renderers to guarantee that the |
| 4548 // surface information required for event hit testing is ready. | 4441 // surface information required for event hit testing is ready. |
| 4549 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( | 4442 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( |
| 4550 root->child_at(0)->current_frame_host()->GetView()); | 4443 root->child_at(0)->current_frame_host()->GetView()); |
| 4551 SurfaceHitTestReadyNotifier notifier( | 4444 SurfaceHitTestReadyNotifier notifier( |
| 4552 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); | 4445 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); |
| 4553 notifier.WaitForSurfaceReady(); | 4446 notifier.WaitForSurfaceReady(); |
| 4554 | 4447 |
| 4555 // Simulate touch event to sub-frame. | 4448 // Simulate touch event to sub-frame. |
| 4556 gfx::Point child_center(150, 150); | 4449 gfx::Point child_center(150, 150); |
| 4557 auto rwhv = static_cast<RenderWidgetHostViewAura*>( | 4450 auto rwhv = static_cast<RenderWidgetHostViewAura*>( |
| 4558 web_contents->GetRenderWidgetHostView()); | 4451 contents->GetRenderWidgetHostView()); |
| 4559 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, | 4452 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, |
| 4560 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); | 4453 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); |
| 4561 rwhv->OnTouchEvent(&touch_event); | 4454 rwhv->OnTouchEvent(&touch_event); |
| 4562 | 4455 |
| 4563 // Verify touch handler in subframe was invoked | 4456 // Verify touch handler in subframe was invoked |
| 4564 std::string result; | 4457 std::string result; |
| 4565 EXPECT_TRUE(ExecuteScriptAndExtractString( | 4458 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 4566 root->child_at(0)->current_frame_host(), | 4459 root->child_at(0)->current_frame_host(), |
| 4567 "window.domAutomationController.send(getLastTouchEvent());", &result)); | 4460 "window.domAutomationController.send(getLastTouchEvent());", &result)); |
| 4568 EXPECT_EQ("touchstart", result); | 4461 EXPECT_EQ("touchstart", result); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 4584 #define MAYBE_SubframeGestureEventRouting DISABLED_SubframeGestureEventRouting | 4477 #define MAYBE_SubframeGestureEventRouting DISABLED_SubframeGestureEventRouting |
| 4585 #else | 4478 #else |
| 4586 #define MAYBE_SubframeGestureEventRouting SubframeGestureEventRouting | 4479 #define MAYBE_SubframeGestureEventRouting SubframeGestureEventRouting |
| 4587 #endif | 4480 #endif |
| 4588 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4481 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4589 MAYBE_SubframeGestureEventRouting) { | 4482 MAYBE_SubframeGestureEventRouting) { |
| 4590 GURL main_url(embedded_test_server()->GetURL( | 4483 GURL main_url(embedded_test_server()->GetURL( |
| 4591 "/frame_tree/page_with_positioned_nested_frames.html")); | 4484 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 4592 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4485 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4593 | 4486 |
| 4594 WebContentsImpl* web_contents = | 4487 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4595 static_cast<WebContentsImpl*>(shell()->web_contents()); | |
| 4596 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4597 ASSERT_EQ(1U, root->child_count()); | 4488 ASSERT_EQ(1U, root->child_count()); |
| 4598 | 4489 |
| 4599 GURL frame_url( | 4490 GURL frame_url( |
| 4600 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); | 4491 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); |
| 4601 NavigateFrameToURL(root->child_at(0), frame_url); | 4492 NavigateFrameToURL(root->child_at(0), frame_url); |
| 4602 auto child_frame_host = root->child_at(0)->current_frame_host(); | 4493 auto child_frame_host = root->child_at(0)->current_frame_host(); |
| 4603 | 4494 |
| 4604 // Synchronize with the child and parent renderers to guarantee that the | 4495 // Synchronize with the child and parent renderers to guarantee that the |
| 4605 // surface information required for event hit testing is ready. | 4496 // surface information required for event hit testing is ready. |
| 4606 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( | 4497 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4719 } | 4610 } |
| 4720 | 4611 |
| 4721 } // namespace anonymous | 4612 } // namespace anonymous |
| 4722 | 4613 |
| 4723 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4614 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4724 InputEventRouterGestureTargetQueueTest) { | 4615 InputEventRouterGestureTargetQueueTest) { |
| 4725 GURL main_url(embedded_test_server()->GetURL( | 4616 GURL main_url(embedded_test_server()->GetURL( |
| 4726 "/frame_tree/page_with_positioned_nested_frames.html")); | 4617 "/frame_tree/page_with_positioned_nested_frames.html")); |
| 4727 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4618 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4728 | 4619 |
| 4729 WebContentsImpl* web_contents = | 4620 WebContentsImpl* contents = web_contents(); |
|
Charlie Reis
2016/04/15 05:25:56
Same.
| |
| 4730 static_cast<WebContentsImpl*>(shell()->web_contents()); | 4621 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 4731 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4732 ASSERT_EQ(1U, root->child_count()); | 4622 ASSERT_EQ(1U, root->child_count()); |
| 4733 | 4623 |
| 4734 GURL frame_url( | 4624 GURL frame_url( |
| 4735 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); | 4625 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); |
| 4736 NavigateFrameToURL(root->child_at(0), frame_url); | 4626 NavigateFrameToURL(root->child_at(0), frame_url); |
| 4737 auto child_frame_host = root->child_at(0)->current_frame_host(); | 4627 auto child_frame_host = root->child_at(0)->current_frame_host(); |
| 4738 | 4628 |
| 4739 // Synchronize with the child and parent renderers to guarantee that the | 4629 // Synchronize with the child and parent renderers to guarantee that the |
| 4740 // surface information required for event hit testing is ready. | 4630 // surface information required for event hit testing is ready. |
| 4741 auto rwhv_child = | 4631 auto rwhv_child = |
| 4742 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); | 4632 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); |
| 4743 SurfaceHitTestReadyNotifier notifier( | 4633 SurfaceHitTestReadyNotifier notifier( |
| 4744 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); | 4634 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); |
| 4745 notifier.WaitForSurfaceReady(); | 4635 notifier.WaitForSurfaceReady(); |
| 4746 | 4636 |
| 4747 // All touches & gestures are sent to the main frame's view, and should be | 4637 // All touches & gestures are sent to the main frame's view, and should be |
| 4748 // routed appropriately from there. | 4638 // routed appropriately from there. |
| 4749 auto rwhv_parent = static_cast<RenderWidgetHostViewBase*>( | 4639 auto rwhv_parent = static_cast<RenderWidgetHostViewBase*>( |
| 4750 web_contents->GetRenderWidgetHostView()); | 4640 contents->GetRenderWidgetHostView()); |
| 4751 | 4641 |
| 4752 RenderWidgetHostInputEventRouter* router = | 4642 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); |
| 4753 web_contents->GetInputEventRouter(); | |
| 4754 EXPECT_TRUE(router->gesture_target_queue_.empty()); | 4643 EXPECT_TRUE(router->gesture_target_queue_.empty()); |
| 4755 EXPECT_EQ(nullptr, router->gesture_target_); | 4644 EXPECT_EQ(nullptr, router->gesture_target_); |
| 4756 | 4645 |
| 4757 // Send touch sequence to main-frame. | 4646 // Send touch sequence to main-frame. |
| 4758 gfx::Point main_frame_point(25, 25); | 4647 gfx::Point main_frame_point(25, 25); |
| 4759 SendTouchTapWithExpectedTarget(rwhv_parent, main_frame_point, | 4648 SendTouchTapWithExpectedTarget(rwhv_parent, main_frame_point, |
| 4760 router->touch_target_, rwhv_parent); | 4649 router->touch_target_, rwhv_parent); |
| 4761 EXPECT_EQ(1LU, router->gesture_target_queue_.size()); | 4650 EXPECT_EQ(1LU, router->gesture_target_queue_.size()); |
| 4762 EXPECT_EQ(nullptr, router->gesture_target_); | 4651 EXPECT_EQ(nullptr, router->gesture_target_); |
| 4763 | 4652 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4820 // The test then repeats this with <shift-tab> to cycle in reverse order. | 4709 // The test then repeats this with <shift-tab> to cycle in reverse order. |
| 4821 | 4710 |
| 4822 // Freqently times out. https://crbug.com/599730. | 4711 // Freqently times out. https://crbug.com/599730. |
| 4823 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 4712 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 4824 DISABLED_SequentialFocusNavigation) { | 4713 DISABLED_SequentialFocusNavigation) { |
| 4825 GURL main_url(embedded_test_server()->GetURL( | 4714 GURL main_url(embedded_test_server()->GetURL( |
| 4826 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); | 4715 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); |
| 4827 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 4716 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 4828 | 4717 |
| 4829 WebContents* contents = shell()->web_contents(); | 4718 WebContents* contents = shell()->web_contents(); |
| 4830 FrameTreeNode* root = | 4719 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 4831 static_cast<WebContentsImpl*>(contents)->GetFrameTree()->root(); | |
| 4832 | 4720 |
| 4833 // Assign a name to each frame. This will be sent along in test messages | 4721 // Assign a name to each frame. This will be sent along in test messages |
| 4834 // from focus events. | 4722 // from focus events. |
| 4835 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), | 4723 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), |
| 4836 "window.name = 'root';")); | 4724 "window.name = 'root';")); |
| 4837 EXPECT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(), | 4725 EXPECT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(), |
| 4838 "window.name = 'child1';")); | 4726 "window.name = 'child1';")); |
| 4839 EXPECT_TRUE(ExecuteScript(root->child_at(1)->current_frame_host(), | 4727 EXPECT_TRUE(ExecuteScript(root->child_at(1)->current_frame_host(), |
| 4840 "window.name = 'child2';")); | 4728 "window.name = 'child2';")); |
| 4841 | 4729 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5094 // on Android. | 4982 // on Android. |
| 5095 #define MAYBE_PopupMenuTest DISABLED_PopupMenuTest | 4983 #define MAYBE_PopupMenuTest DISABLED_PopupMenuTest |
| 5096 #else | 4984 #else |
| 5097 #define MAYBE_PopupMenuTest PopupMenuTest | 4985 #define MAYBE_PopupMenuTest PopupMenuTest |
| 5098 #endif | 4986 #endif |
| 5099 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_PopupMenuTest) { | 4987 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_PopupMenuTest) { |
| 5100 GURL main_url( | 4988 GURL main_url( |
| 5101 embedded_test_server()->GetURL("/cross_site_iframe_factory.html?a(a)")); | 4989 embedded_test_server()->GetURL("/cross_site_iframe_factory.html?a(a)")); |
| 5102 NavigateToURL(shell(), main_url); | 4990 NavigateToURL(shell(), main_url); |
| 5103 | 4991 |
| 5104 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 4992 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5105 ->GetFrameTree() | |
| 5106 ->root(); | |
| 5107 | 4993 |
| 5108 #if !defined(OS_MACOSX) | 4994 #if !defined(OS_MACOSX) |
| 5109 // Unused variable on Mac. | 4995 // Unused variable on Mac. |
| 5110 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( | 4996 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( |
| 5111 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4997 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 5112 #endif | 4998 #endif |
| 5113 static_cast<WebContentsImpl*>(shell()->web_contents())->SendScreenRects(); | 4999 web_contents()->SendScreenRects(); |
| 5114 | 5000 |
| 5115 content::TestNavigationObserver navigation_observer(shell()->web_contents()); | 5001 content::TestNavigationObserver navigation_observer(shell()->web_contents()); |
| 5116 FrameTreeNode* child_node = root->child_at(0); | 5002 FrameTreeNode* child_node = root->child_at(0); |
| 5117 GURL site_url(embedded_test_server()->GetURL( | 5003 GURL site_url(embedded_test_server()->GetURL( |
| 5118 "baz.com", "/site_isolation/page-with-select.html")); | 5004 "baz.com", "/site_isolation/page-with-select.html")); |
| 5119 NavigateFrameToURL(child_node, site_url); | 5005 NavigateFrameToURL(child_node, site_url); |
| 5120 navigation_observer.Wait(); | 5006 navigation_observer.Wait(); |
| 5121 | 5007 |
| 5122 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | 5008 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 5123 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5009 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5165 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest | 5051 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest |
| 5166 #else | 5052 #else |
| 5167 // Times out frequently. https://crbug.com/599730. | 5053 // Times out frequently. https://crbug.com/599730. |
| 5168 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest | 5054 #define MAYBE_NestedPopupMenuTest DISABLED_NestedPopupMenuTest |
| 5169 #endif | 5055 #endif |
| 5170 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_NestedPopupMenuTest) { | 5056 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_NestedPopupMenuTest) { |
| 5171 GURL main_url(embedded_test_server()->GetURL( | 5057 GURL main_url(embedded_test_server()->GetURL( |
| 5172 "/cross_site_iframe_factory.html?a(b(c))")); | 5058 "/cross_site_iframe_factory.html?a(b(c))")); |
| 5173 NavigateToURL(shell(), main_url); | 5059 NavigateToURL(shell(), main_url); |
| 5174 | 5060 |
| 5175 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5061 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5176 ->GetFrameTree() | |
| 5177 ->root(); | |
| 5178 | 5062 |
| 5179 #if !defined(OS_MACOSX) | 5063 #if !defined(OS_MACOSX) |
| 5180 // Undefined variable on Mac. | 5064 // Undefined variable on Mac. |
| 5181 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( | 5065 RenderWidgetHostViewBase* rwhv_root = static_cast<RenderWidgetHostViewBase*>( |
| 5182 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5066 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 5183 #endif | 5067 #endif |
| 5184 static_cast<WebContentsImpl*>(shell()->web_contents())->SendScreenRects(); | 5068 web_contents()->SendScreenRects(); |
| 5185 | 5069 |
| 5186 // For clarity, we are labeling the frame tree nodes as: | 5070 // For clarity, we are labeling the frame tree nodes as: |
| 5187 // - root_node | 5071 // - root_node |
| 5188 // \-> b_node (out-of-process from root and c_node) | 5072 // \-> b_node (out-of-process from root and c_node) |
| 5189 // \-> c_node (out-of-process from root and b_node) | 5073 // \-> c_node (out-of-process from root and b_node) |
| 5190 | 5074 |
| 5191 content::TestNavigationObserver navigation_observer(shell()->web_contents()); | 5075 content::TestNavigationObserver navigation_observer(shell()->web_contents()); |
| 5192 FrameTreeNode* b_node = root->child_at(0); | 5076 FrameTreeNode* b_node = root->child_at(0); |
| 5193 FrameTreeNode* c_node = b_node->child_at(0); | 5077 FrameTreeNode* c_node = b_node->child_at(0); |
| 5194 GURL site_url(embedded_test_server()->GetURL( | 5078 GURL site_url(embedded_test_server()->GetURL( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5451 // if a pending cross-process navigation is cancelled. The test works by trying | 5335 // if a pending cross-process navigation is cancelled. The test works by trying |
| 5452 // to create a new RenderFrame with the same routing id. If there is an | 5336 // to create a new RenderFrame with the same routing id. If there is an |
| 5453 // entry with the same routing ID, a CHECK is hit and the process crashes. | 5337 // entry with the same routing ID, a CHECK is hit and the process crashes. |
| 5454 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5338 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5455 SubframePendingAndBackToSameSiteInstance) { | 5339 SubframePendingAndBackToSameSiteInstance) { |
| 5456 GURL main_url(embedded_test_server()->GetURL( | 5340 GURL main_url(embedded_test_server()->GetURL( |
| 5457 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 5341 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 5458 NavigateToURL(shell(), main_url); | 5342 NavigateToURL(shell(), main_url); |
| 5459 | 5343 |
| 5460 // Capture the FrameTreeNode this test will be navigating. | 5344 // Capture the FrameTreeNode this test will be navigating. |
| 5461 FrameTreeNode* node = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5345 FrameTreeNode* node = web_contents()->GetFrameTree()->root()->child_at(0); |
| 5462 ->GetFrameTree() | |
| 5463 ->root() | |
| 5464 ->child_at(0); | |
| 5465 EXPECT_TRUE(node); | 5346 EXPECT_TRUE(node); |
| 5466 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), | 5347 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), |
| 5467 node->parent()->current_frame_host()->GetSiteInstance()); | 5348 node->parent()->current_frame_host()->GetSiteInstance()); |
| 5468 | 5349 |
| 5469 // Navigate to the site of the parent, but to a page that will not commit. | 5350 // Navigate to the site of the parent, but to a page that will not commit. |
| 5470 GURL same_site_url(embedded_test_server()->GetURL("a.com", "/title1.html")); | 5351 GURL same_site_url(embedded_test_server()->GetURL("a.com", "/title1.html")); |
| 5471 NavigationStallDelegate stall_delegate(same_site_url); | 5352 NavigationStallDelegate stall_delegate(same_site_url); |
| 5472 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); | 5353 ResourceDispatcherHost::Get()->SetDelegate(&stall_delegate); |
| 5473 { | 5354 { |
| 5474 NavigationController::LoadURLParams params(same_site_url); | 5355 NavigationController::LoadURLParams params(same_site_url); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5528 | 5409 |
| 5529 // This test ensures that the RenderFrame isn't leaked in the renderer process | 5410 // This test ensures that the RenderFrame isn't leaked in the renderer process |
| 5530 // when a remote parent detaches a child frame. The test works by trying | 5411 // when a remote parent detaches a child frame. The test works by trying |
| 5531 // to create a new RenderFrame with the same routing id. If there is an | 5412 // to create a new RenderFrame with the same routing id. If there is an |
| 5532 // entry with the same routing ID, a CHECK is hit and the process crashes. | 5413 // entry with the same routing ID, a CHECK is hit and the process crashes. |
| 5533 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ParentDetachRemoteChild) { | 5414 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ParentDetachRemoteChild) { |
| 5534 GURL main_url(embedded_test_server()->GetURL( | 5415 GURL main_url(embedded_test_server()->GetURL( |
| 5535 "a.com", "/cross_site_iframe_factory.html?a(b,b)")); | 5416 "a.com", "/cross_site_iframe_factory.html?a(b,b)")); |
| 5536 NavigateToURL(shell(), main_url); | 5417 NavigateToURL(shell(), main_url); |
| 5537 | 5418 |
| 5538 WebContentsImpl* web_contents = | 5419 WebContentsImpl* contents = web_contents(); |
|
Charlie Reis
2016/04/15 05:25:56
Same.
| |
| 5539 static_cast<WebContentsImpl*>(shell()->web_contents()); | 5420 EXPECT_EQ(2U, contents->GetFrameTree()->root()->child_count()); |
| 5540 EXPECT_EQ(2U, web_contents->GetFrameTree()->root()->child_count()); | |
| 5541 | 5421 |
| 5542 // Capture the FrameTreeNode this test will be navigating. | 5422 // Capture the FrameTreeNode this test will be navigating. |
| 5543 FrameTreeNode* node = web_contents->GetFrameTree()->root()->child_at(0); | 5423 FrameTreeNode* node = contents->GetFrameTree()->root()->child_at(0); |
| 5544 EXPECT_TRUE(node); | 5424 EXPECT_TRUE(node); |
| 5545 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), | 5425 EXPECT_NE(node->current_frame_host()->GetSiteInstance(), |
| 5546 node->parent()->current_frame_host()->GetSiteInstance()); | 5426 node->parent()->current_frame_host()->GetSiteInstance()); |
| 5547 | 5427 |
| 5548 // Grab the routing id of the first child RenderFrameHost and set up a process | 5428 // Grab the routing id of the first child RenderFrameHost and set up a process |
| 5549 // observer to ensure there is no crash when a new RenderFrame creation is | 5429 // observer to ensure there is no crash when a new RenderFrame creation is |
| 5550 // attempted. | 5430 // attempted. |
| 5551 RenderProcessHost* process = node->current_frame_host()->GetProcess(); | 5431 RenderProcessHost* process = node->current_frame_host()->GetProcess(); |
| 5552 RenderProcessHostWatcher watcher( | 5432 RenderProcessHostWatcher watcher( |
| 5553 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); | 5433 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 5554 int frame_routing_id = node->current_frame_host()->GetRoutingID(); | 5434 int frame_routing_id = node->current_frame_host()->GetRoutingID(); |
| 5555 int widget_routing_id = | 5435 int widget_routing_id = |
| 5556 node->current_frame_host()->GetRenderWidgetHost()->GetRoutingID(); | 5436 node->current_frame_host()->GetRenderWidgetHost()->GetRoutingID(); |
| 5557 int parent_routing_id = | 5437 int parent_routing_id = |
| 5558 node->parent()->render_manager()->GetRoutingIdForSiteInstance( | 5438 node->parent()->render_manager()->GetRoutingIdForSiteInstance( |
| 5559 node->current_frame_host()->GetSiteInstance()); | 5439 node->current_frame_host()->GetSiteInstance()); |
| 5560 | 5440 |
| 5561 // Have the parent frame remove the child frame from its DOM. This should | 5441 // Have the parent frame remove the child frame from its DOM. This should |
| 5562 // result in the child RenderFrame being deleted in the remote process. | 5442 // result in the child RenderFrame being deleted in the remote process. |
| 5563 EXPECT_TRUE(ExecuteScript(web_contents, | 5443 EXPECT_TRUE(ExecuteScript(contents, |
| 5564 "document.body.removeChild(" | 5444 "document.body.removeChild(" |
| 5565 "document.querySelectorAll('iframe')[0])")); | 5445 "document.querySelectorAll('iframe')[0])")); |
| 5566 EXPECT_EQ(1U, web_contents->GetFrameTree()->root()->child_count()); | 5446 EXPECT_EQ(1U, contents->GetFrameTree()->root()->child_count()); |
| 5567 | 5447 |
| 5568 { | 5448 { |
| 5569 FrameMsg_NewFrame_Params params; | 5449 FrameMsg_NewFrame_Params params; |
| 5570 params.routing_id = frame_routing_id; | 5450 params.routing_id = frame_routing_id; |
| 5571 params.proxy_routing_id = MSG_ROUTING_NONE; | 5451 params.proxy_routing_id = MSG_ROUTING_NONE; |
| 5572 params.opener_routing_id = MSG_ROUTING_NONE; | 5452 params.opener_routing_id = MSG_ROUTING_NONE; |
| 5573 params.parent_routing_id = parent_routing_id; | 5453 params.parent_routing_id = parent_routing_id; |
| 5574 params.previous_sibling_routing_id = MSG_ROUTING_NONE; | 5454 params.previous_sibling_routing_id = MSG_ROUTING_NONE; |
| 5575 params.widget_params.routing_id = widget_routing_id; | 5455 params.widget_params.routing_id = widget_routing_id; |
| 5576 params.widget_params.hidden = true; | 5456 params.widget_params.hidden = true; |
| 5577 params.replication_state.name = "name"; | 5457 params.replication_state.name = "name"; |
| 5578 params.replication_state.unique_name = "name"; | 5458 params.replication_state.unique_name = "name"; |
| 5579 | 5459 |
| 5580 process->Send(new FrameMsg_NewFrame(params)); | 5460 process->Send(new FrameMsg_NewFrame(params)); |
| 5581 } | 5461 } |
| 5582 | 5462 |
| 5583 // The test must wait for the process to exit, but if there is no leak, the | 5463 // The test must wait for the process to exit, but if there is no leak, the |
| 5584 // RenderFrame will be properly created and there will be no crash. | 5464 // RenderFrame will be properly created and there will be no crash. |
| 5585 // Therefore, navigate the remaining subframe to completely different site, | 5465 // Therefore, navigate the remaining subframe to completely different site, |
| 5586 // which will cause the original process to exit cleanly. | 5466 // which will cause the original process to exit cleanly. |
| 5587 NavigateFrameToURL( | 5467 NavigateFrameToURL(contents->GetFrameTree()->root()->child_at(0), |
| 5588 web_contents->GetFrameTree()->root()->child_at(0), | 5468 embedded_test_server()->GetURL("d.com", "/title3.html")); |
| 5589 embedded_test_server()->GetURL("d.com", "/title3.html")); | |
| 5590 watcher.Wait(); | 5469 watcher.Wait(); |
| 5591 EXPECT_TRUE(watcher.did_exit_normally()); | 5470 EXPECT_TRUE(watcher.did_exit_normally()); |
| 5592 } | 5471 } |
| 5593 | 5472 |
| 5594 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChanged) { | 5473 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChanged) { |
| 5595 GURL main_url( | 5474 GURL main_url( |
| 5596 embedded_test_server()->GetURL("a.com", "/page_with_iframe.html")); | 5475 embedded_test_server()->GetURL("a.com", "/page_with_iframe.html")); |
| 5597 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 5476 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5598 EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), main_url); | 5477 EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), main_url); |
| 5599 | 5478 |
| 5600 GURL cross_site_url = | 5479 GURL cross_site_url = |
| 5601 embedded_test_server()->GetURL("oopif.com", "/title1.html"); | 5480 embedded_test_server()->GetURL("oopif.com", "/title1.html"); |
| 5602 | 5481 |
| 5603 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5482 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5604 ->GetFrameTree() | |
| 5605 ->root(); | |
| 5606 | 5483 |
| 5607 TestNavigationObserver observer(shell()->web_contents()); | 5484 TestNavigationObserver observer(shell()->web_contents()); |
| 5608 | 5485 |
| 5609 NavigateFrameToURL(root->child_at(0), cross_site_url); | 5486 NavigateFrameToURL(root->child_at(0), cross_site_url); |
| 5610 EXPECT_EQ(cross_site_url, observer.last_navigation_url()); | 5487 EXPECT_EQ(cross_site_url, observer.last_navigation_url()); |
| 5611 EXPECT_TRUE(observer.last_navigation_succeeded()); | 5488 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 5612 | 5489 |
| 5613 RenderWidgetHostImpl* render_widget_host = | 5490 RenderWidgetHostImpl* render_widget_host = |
| 5614 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 5491 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 5615 EXPECT_FALSE(render_widget_host->is_hidden()); | 5492 EXPECT_FALSE(render_widget_host->is_hidden()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 5633 } | 5510 } |
| 5634 | 5511 |
| 5635 // Verify that sandbox flags inheritance works across multiple levels of | 5512 // Verify that sandbox flags inheritance works across multiple levels of |
| 5636 // frames. See https://crbug.com/576845. | 5513 // frames. See https://crbug.com/576845. |
| 5637 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsInheritance) { | 5514 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SandboxFlagsInheritance) { |
| 5638 GURL main_url(embedded_test_server()->GetURL( | 5515 GURL main_url(embedded_test_server()->GetURL( |
| 5639 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5516 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5640 NavigateToURL(shell(), main_url); | 5517 NavigateToURL(shell(), main_url); |
| 5641 | 5518 |
| 5642 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5519 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5643 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5520 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5644 ->GetFrameTree() | |
| 5645 ->root(); | |
| 5646 | 5521 |
| 5647 // Set sandbox flags for child frame. | 5522 // Set sandbox flags for child frame. |
| 5648 EXPECT_TRUE(ExecuteScript( | 5523 EXPECT_TRUE(ExecuteScript( |
| 5649 root->current_frame_host(), | 5524 root->current_frame_host(), |
| 5650 "document.querySelector('iframe').sandbox = 'allow-scripts';")); | 5525 "document.querySelector('iframe').sandbox = 'allow-scripts';")); |
| 5651 | 5526 |
| 5652 // Calculate expected flags. Note that "allow-scripts" resets both | 5527 // Calculate expected flags. Note that "allow-scripts" resets both |
| 5653 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per | 5528 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per |
| 5654 // blink::parseSandboxPolicy(). | 5529 // blink::parseSandboxPolicy(). |
| 5655 blink::WebSandboxFlags expected_flags = | 5530 blink::WebSandboxFlags expected_flags = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5688 // a child frame, update its sandbox flags but don't navigate the frame, and | 5563 // a child frame, update its sandbox flags but don't navigate the frame, and |
| 5689 // ensure that a new cross-site grandchild frame doesn't inherit the new flags | 5564 // ensure that a new cross-site grandchild frame doesn't inherit the new flags |
| 5690 // (which shouldn't have taken effect). | 5565 // (which shouldn't have taken effect). |
| 5691 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5566 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5692 SandboxFlagsNotInheritedBeforeNavigation) { | 5567 SandboxFlagsNotInheritedBeforeNavigation) { |
| 5693 GURL main_url(embedded_test_server()->GetURL( | 5568 GURL main_url(embedded_test_server()->GetURL( |
| 5694 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5569 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5695 NavigateToURL(shell(), main_url); | 5570 NavigateToURL(shell(), main_url); |
| 5696 | 5571 |
| 5697 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5572 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5698 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5573 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5699 ->GetFrameTree() | |
| 5700 ->root(); | |
| 5701 | 5574 |
| 5702 // Set sandbox flags for child frame. | 5575 // Set sandbox flags for child frame. |
| 5703 EXPECT_TRUE(ExecuteScript( | 5576 EXPECT_TRUE(ExecuteScript( |
| 5704 root->current_frame_host(), | 5577 root->current_frame_host(), |
| 5705 "document.querySelector('iframe').sandbox = 'allow-scripts';")); | 5578 "document.querySelector('iframe').sandbox = 'allow-scripts';")); |
| 5706 | 5579 |
| 5707 // These flags should be pending but not take effect, since there's been no | 5580 // These flags should be pending but not take effect, since there's been no |
| 5708 // navigation. | 5581 // navigation. |
| 5709 blink::WebSandboxFlags expected_flags = | 5582 blink::WebSandboxFlags expected_flags = |
| 5710 blink::WebSandboxFlags::All & ~blink::WebSandboxFlags::Scripts & | 5583 blink::WebSandboxFlags::All & ~blink::WebSandboxFlags::Scripts & |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 5740 // Verify that popups opened from sandboxed frames inherit sandbox flags from | 5613 // Verify that popups opened from sandboxed frames inherit sandbox flags from |
| 5741 // their opener, and that they keep these inherited flags after being navigated | 5614 // their opener, and that they keep these inherited flags after being navigated |
| 5742 // cross-site. See https://crbug.com/483584. | 5615 // cross-site. See https://crbug.com/483584. |
| 5743 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5616 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5744 NewPopupInheritsSandboxFlagsFromOpener) { | 5617 NewPopupInheritsSandboxFlagsFromOpener) { |
| 5745 GURL main_url(embedded_test_server()->GetURL( | 5618 GURL main_url(embedded_test_server()->GetURL( |
| 5746 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5619 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5747 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 5620 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5748 | 5621 |
| 5749 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5622 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5750 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5623 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5751 ->GetFrameTree() | |
| 5752 ->root(); | |
| 5753 | 5624 |
| 5754 // Set sandbox flags for child frame. | 5625 // Set sandbox flags for child frame. |
| 5755 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), | 5626 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), |
| 5756 "document.querySelector('iframe').sandbox = " | 5627 "document.querySelector('iframe').sandbox = " |
| 5757 " 'allow-scripts allow-popups';")); | 5628 " 'allow-scripts allow-popups';")); |
| 5758 | 5629 |
| 5759 // Calculate expected flags. Note that "allow-scripts" resets both | 5630 // Calculate expected flags. Note that "allow-scripts" resets both |
| 5760 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per | 5631 // WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits per |
| 5761 // blink::parseSandboxPolicy(). | 5632 // blink::parseSandboxPolicy(). |
| 5762 blink::WebSandboxFlags expected_flags = | 5633 blink::WebSandboxFlags expected_flags = |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5811 // Verify that popups opened from frames sandboxed with the | 5682 // Verify that popups opened from frames sandboxed with the |
| 5812 // "allow-popups-to-escape-sandbox" directive do *not* inherit sandbox flags | 5683 // "allow-popups-to-escape-sandbox" directive do *not* inherit sandbox flags |
| 5813 // from their opener. | 5684 // from their opener. |
| 5814 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5685 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 5815 OpenUnsandboxedPopupFromSandboxedFrame) { | 5686 OpenUnsandboxedPopupFromSandboxedFrame) { |
| 5816 GURL main_url(embedded_test_server()->GetURL( | 5687 GURL main_url(embedded_test_server()->GetURL( |
| 5817 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5688 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 5818 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 5689 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 5819 | 5690 |
| 5820 // It is safe to obtain the root frame tree node here, as it doesn't change. | 5691 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 5821 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5692 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5822 ->GetFrameTree() | |
| 5823 ->root(); | |
| 5824 | 5693 |
| 5825 // Set sandbox flags for child frame, specifying that popups opened from it | 5694 // Set sandbox flags for child frame, specifying that popups opened from it |
| 5826 // should not be sandboxed. | 5695 // should not be sandboxed. |
| 5827 EXPECT_TRUE(ExecuteScript( | 5696 EXPECT_TRUE(ExecuteScript( |
| 5828 root->current_frame_host(), | 5697 root->current_frame_host(), |
| 5829 "document.querySelector('iframe').sandbox = " | 5698 "document.querySelector('iframe').sandbox = " |
| 5830 " 'allow-scripts allow-popups allow-popups-to-escape-sandbox';")); | 5699 " 'allow-scripts allow-popups allow-popups-to-escape-sandbox';")); |
| 5831 | 5700 |
| 5832 // Set expected flags for the child frame. Note that "allow-scripts" resets | 5701 // Set expected flags for the child frame. Note that "allow-scripts" resets |
| 5833 // both WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits | 5702 // both WebSandboxFlags::Scripts and WebSandboxFlags::AutomaticFeatures bits |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5888 SetupCrossSiteRedirector(&https_server); | 5757 SetupCrossSiteRedirector(&https_server); |
| 5889 | 5758 |
| 5890 GURL iframe_url( | 5759 GURL iframe_url( |
| 5891 https_server.GetURL("/mixed-content/basic-passive-in-iframe.html")); | 5760 https_server.GetURL("/mixed-content/basic-passive-in-iframe.html")); |
| 5892 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); | 5761 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); |
| 5893 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); | 5762 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5894 | 5763 |
| 5895 // When the subframe navigates, the WebContents should still be marked | 5764 // When the subframe navigates, the WebContents should still be marked |
| 5896 // as having displayed insecure content. | 5765 // as having displayed insecure content. |
| 5897 GURL navigate_url(https_server.GetURL("/title1.html")); | 5766 GURL navigate_url(https_server.GetURL("/title1.html")); |
| 5898 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5767 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5899 ->GetFrameTree() | |
| 5900 ->root(); | |
| 5901 NavigateFrameToURL(root->child_at(0), navigate_url); | 5768 NavigateFrameToURL(root->child_at(0), navigate_url); |
| 5902 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); | 5769 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5903 | 5770 |
| 5904 // When the main frame navigates, it should no longer be marked as | 5771 // When the main frame navigates, it should no longer be marked as |
| 5905 // displaying insecure content. | 5772 // displaying insecure content. |
| 5906 EXPECT_TRUE( | 5773 EXPECT_TRUE( |
| 5907 NavigateToURL(shell(), https_server.GetURL("b.com", "/title1.html"))); | 5774 NavigateToURL(shell(), https_server.GetURL("b.com", "/title1.html"))); |
| 5908 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); | 5775 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5909 } | 5776 } |
| 5910 | 5777 |
| 5911 // Tests that, when a parent frame is set to strictly block mixed | 5778 // Tests that, when a parent frame is set to strictly block mixed |
| 5912 // content via Content Security Policy, child OOPIFs cannot display | 5779 // content via Content Security Policy, child OOPIFs cannot display |
| 5913 // mixed content. | 5780 // mixed content. |
| 5914 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, | 5781 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
| 5915 PassiveMixedContentInIframeWithStrictBlocking) { | 5782 PassiveMixedContentInIframeWithStrictBlocking) { |
| 5916 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 5783 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 5917 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 5784 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| 5918 ASSERT_TRUE(https_server.Start()); | 5785 ASSERT_TRUE(https_server.Start()); |
| 5919 SetupCrossSiteRedirector(&https_server); | 5786 SetupCrossSiteRedirector(&https_server); |
| 5920 | 5787 |
| 5921 GURL iframe_url_with_strict_blocking(https_server.GetURL( | 5788 GURL iframe_url_with_strict_blocking(https_server.GetURL( |
| 5922 "/mixed-content/basic-passive-in-iframe-with-strict-blocking.html")); | 5789 "/mixed-content/basic-passive-in-iframe-with-strict-blocking.html")); |
| 5923 EXPECT_TRUE(NavigateToURL(shell(), iframe_url_with_strict_blocking)); | 5790 EXPECT_TRUE(NavigateToURL(shell(), iframe_url_with_strict_blocking)); |
| 5924 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); | 5791 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
| 5925 | 5792 |
| 5926 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5793 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5927 ->GetFrameTree() | |
| 5928 ->root(); | |
| 5929 EXPECT_TRUE(root->current_replication_state() | 5794 EXPECT_TRUE(root->current_replication_state() |
| 5930 .should_enforce_strict_mixed_content_checking); | 5795 .should_enforce_strict_mixed_content_checking); |
| 5931 EXPECT_TRUE(root->child_at(0) | 5796 EXPECT_TRUE(root->child_at(0) |
| 5932 ->current_replication_state() | 5797 ->current_replication_state() |
| 5933 .should_enforce_strict_mixed_content_checking); | 5798 .should_enforce_strict_mixed_content_checking); |
| 5934 | 5799 |
| 5935 // When the subframe navigates, it should still be marked as enforcing | 5800 // When the subframe navigates, it should still be marked as enforcing |
| 5936 // strict mixed content. | 5801 // strict mixed content. |
| 5937 GURL navigate_url(https_server.GetURL("/title1.html")); | 5802 GURL navigate_url(https_server.GetURL("/title1.html")); |
| 5938 NavigateFrameToURL(root->child_at(0), navigate_url); | 5803 NavigateFrameToURL(root->child_at(0), navigate_url); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 5957 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, | 5822 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
| 5958 ActiveMixedContentInIframe) { | 5823 ActiveMixedContentInIframe) { |
| 5959 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); | 5824 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
| 5960 https_server.ServeFilesFromSourceDirectory("content/test/data"); | 5825 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
| 5961 ASSERT_TRUE(https_server.Start()); | 5826 ASSERT_TRUE(https_server.Start()); |
| 5962 SetupCrossSiteRedirector(&https_server); | 5827 SetupCrossSiteRedirector(&https_server); |
| 5963 | 5828 |
| 5964 GURL iframe_url( | 5829 GURL iframe_url( |
| 5965 https_server.GetURL("/mixed-content/basic-active-in-iframe.html")); | 5830 https_server.GetURL("/mixed-content/basic-active-in-iframe.html")); |
| 5966 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); | 5831 EXPECT_TRUE(NavigateToURL(shell(), iframe_url)); |
| 5967 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5832 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5968 ->GetFrameTree() | |
| 5969 ->root(); | |
| 5970 ASSERT_EQ(1U, root->child_count()); | 5833 ASSERT_EQ(1U, root->child_count()); |
| 5971 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); | 5834 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); |
| 5972 ASSERT_TRUE(mixed_child); | 5835 ASSERT_TRUE(mixed_child); |
| 5973 // The child iframe attempted to create a mixed iframe; this should | 5836 // The child iframe attempted to create a mixed iframe; this should |
| 5974 // have been blocked, so the mixed iframe should not have committed a | 5837 // have been blocked, so the mixed iframe should not have committed a |
| 5975 // load. | 5838 // load. |
| 5976 EXPECT_FALSE(mixed_child->has_committed_real_load()); | 5839 EXPECT_FALSE(mixed_child->has_committed_real_load()); |
| 5977 } | 5840 } |
| 5978 | 5841 |
| 5979 // Test setting a cross-origin iframe to display: none. | 5842 // Test setting a cross-origin iframe to display: none. |
| 5980 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframeDisplayNone) { | 5843 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframeDisplayNone) { |
| 5981 GURL main_url(embedded_test_server()->GetURL( | 5844 GURL main_url(embedded_test_server()->GetURL( |
| 5982 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 5845 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 5983 NavigateToURL(shell(), main_url); | 5846 NavigateToURL(shell(), main_url); |
| 5984 | 5847 |
| 5985 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5848 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 5986 ->GetFrameTree() | |
| 5987 ->root(); | |
| 5988 RenderWidgetHost* root_render_widget_host = | 5849 RenderWidgetHost* root_render_widget_host = |
| 5989 root->current_frame_host()->GetRenderWidgetHost(); | 5850 root->current_frame_host()->GetRenderWidgetHost(); |
| 5990 | 5851 |
| 5991 // Set the iframe to display: none. | 5852 // Set the iframe to display: none. |
| 5992 EXPECT_TRUE( | 5853 EXPECT_TRUE( |
| 5993 ExecuteScript(shell()->web_contents(), | 5854 ExecuteScript(shell()->web_contents(), |
| 5994 "document.querySelector('iframe').style.display = 'none'")); | 5855 "document.querySelector('iframe').style.display = 'none'")); |
| 5995 | 5856 |
| 5996 // Waits until pending frames are done. | 5857 // Waits until pending frames are done. |
| 5997 std::unique_ptr<MainThreadFrameObserver> observer( | 5858 std::unique_ptr<MainThreadFrameObserver> observer( |
| 5998 new MainThreadFrameObserver(root_render_widget_host)); | 5859 new MainThreadFrameObserver(root_render_widget_host)); |
| 5999 observer->Wait(); | 5860 observer->Wait(); |
| 6000 | 5861 |
| 6001 // Force the renderer to generate a new frame. | 5862 // Force the renderer to generate a new frame. |
| 6002 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5863 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
| 6003 "document.body.style.background = 'black'")); | 5864 "document.body.style.background = 'black'")); |
| 6004 | 5865 |
| 6005 // Waits for the next frame. | 5866 // Waits for the next frame. |
| 6006 observer->Wait(); | 5867 observer->Wait(); |
| 6007 } | 5868 } |
| 6008 | 5869 |
| 6009 // Test that a cross-origin iframe can be blocked by X-Frame-Options and CSP | 5870 // Test that a cross-origin iframe can be blocked by X-Frame-Options and CSP |
| 6010 // frame-ancestors. | 5871 // frame-ancestors. |
| 6011 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 5872 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 6012 CrossSiteIframeBlockedByXFrameOptionsOrCSP) { | 5873 CrossSiteIframeBlockedByXFrameOptionsOrCSP) { |
| 6013 GURL main_url(embedded_test_server()->GetURL( | 5874 GURL main_url(embedded_test_server()->GetURL( |
| 6014 "a.com", "/cross_site_iframe_factory.html?a(a)")); | 5875 "a.com", "/cross_site_iframe_factory.html?a(a)")); |
| 6015 NavigateToURL(shell(), main_url); | 5876 NavigateToURL(shell(), main_url); |
| 6016 | 5877 |
| 6017 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5878 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6018 ->GetFrameTree() | |
| 6019 ->root(); | |
| 6020 | 5879 |
| 6021 // Add a load event handler for the iframe element. | 5880 // Add a load event handler for the iframe element. |
| 6022 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 5881 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
| 6023 "document.querySelector('iframe').onload = " | 5882 "document.querySelector('iframe').onload = " |
| 6024 " function() { document.title = 'loaded'; };")); | 5883 " function() { document.title = 'loaded'; };")); |
| 6025 | 5884 |
| 6026 GURL blocked_urls[] = { | 5885 GURL blocked_urls[] = { |
| 6027 embedded_test_server()->GetURL("b.com", "/frame-ancestors-none.html"), | 5886 embedded_test_server()->GetURL("b.com", "/frame-ancestors-none.html"), |
| 6028 embedded_test_server()->GetURL("b.com", "/x-frame-options-deny.html") | 5887 embedded_test_server()->GetURL("b.com", "/x-frame-options-deny.html") |
| 6029 }; | 5888 }; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6077 EXPECT_EQ(blink::WebSandboxFlags::None, | 5936 EXPECT_EQ(blink::WebSandboxFlags::None, |
| 6078 root->child_at(0)->effective_sandbox_flags()); | 5937 root->child_at(0)->effective_sandbox_flags()); |
| 6079 } | 5938 } |
| 6080 } | 5939 } |
| 6081 | 5940 |
| 6082 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ScreenCoordinates) { | 5941 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ScreenCoordinates) { |
| 6083 GURL main_url(embedded_test_server()->GetURL( | 5942 GURL main_url(embedded_test_server()->GetURL( |
| 6084 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 5943 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 6085 NavigateToURL(shell(), main_url); | 5944 NavigateToURL(shell(), main_url); |
| 6086 | 5945 |
| 6087 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5946 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 6088 ->GetFrameTree() | |
| 6089 ->root(); | |
| 6090 FrameTreeNode* child = root->child_at(0); | 5947 FrameTreeNode* child = root->child_at(0); |
| 6091 | 5948 |
| 6092 const char* properties[] = {"screenX", "screenY", "outerWidth", | 5949 const char* properties[] = {"screenX", "screenY", "outerWidth", |
| 6093 "outerHeight"}; | 5950 "outerHeight"}; |
| 6094 | 5951 |
| 6095 for (const char* property : properties) { | 5952 for (const char* property : properties) { |
| 6096 std::string script = "window.domAutomationController.send(window."; | 5953 std::string script = "window.domAutomationController.send(window."; |
| 6097 script += property; | 5954 script += property; |
| 6098 script += ");"; | 5955 script += ");"; |
| 6099 int root_value = 1; | 5956 int root_value = 1; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6163 | 6020 |
| 6164 // Tests that the swapped out state on RenderViewHost is properly reset when | 6021 // Tests that the swapped out state on RenderViewHost is properly reset when |
| 6165 // the main frame is navigated to the same SiteInstance as one of its child | 6022 // the main frame is navigated to the same SiteInstance as one of its child |
| 6166 // frames. | 6023 // frames. |
| 6167 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 6024 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 6168 NavigateMainFrameToChildSite) { | 6025 NavigateMainFrameToChildSite) { |
| 6169 GURL main_url(embedded_test_server()->GetURL( | 6026 GURL main_url(embedded_test_server()->GetURL( |
| 6170 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 6027 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 6171 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | 6028 EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
| 6172 | 6029 |
| 6173 WebContentsImpl* contents = | 6030 WebContentsImpl* contents = web_contents(); |
|
Charlie Reis
2016/04/15 05:25:56
Same.
| |
| 6174 static_cast<WebContentsImpl*>(shell()->web_contents()); | |
| 6175 FrameTreeNode* root = contents->GetFrameTree()->root(); | 6031 FrameTreeNode* root = contents->GetFrameTree()->root(); |
| 6176 EXPECT_EQ(1U, root->child_count()); | 6032 EXPECT_EQ(1U, root->child_count()); |
| 6177 | 6033 |
| 6178 // Ensure the RenderViewHost for the SiteInstance of the child is considered | 6034 // Ensure the RenderViewHost for the SiteInstance of the child is considered |
| 6179 // in swapped out state. | 6035 // in swapped out state. |
| 6180 RenderViewHostImpl* rvh = contents->GetFrameTree()->GetRenderViewHost( | 6036 RenderViewHostImpl* rvh = contents->GetFrameTree()->GetRenderViewHost( |
| 6181 root->child_at(0)->current_frame_host()->GetSiteInstance()); | 6037 root->child_at(0)->current_frame_host()->GetSiteInstance()); |
| 6182 EXPECT_TRUE(rvh->is_swapped_out_); | 6038 EXPECT_TRUE(rvh->is_swapped_out_); |
| 6183 | 6039 |
| 6184 // Have the child frame navigate its parent to its SiteInstance. | 6040 // Have the child frame navigate its parent to its SiteInstance. |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6407 root->current_frame_host()->GetRenderWidgetHost(); | 6263 root->current_frame_host()->GetRenderWidgetHost(); |
| 6408 press_tab_and_wait_for_state_change(root_rwh); | 6264 press_tab_and_wait_for_state_change(root_rwh); |
| 6409 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type); | 6265 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type); |
| 6410 | 6266 |
| 6411 // Crash the tab renderer and observer the input state going back to none. | 6267 // Crash the tab renderer and observer the input state going back to none. |
| 6412 RenderProcessHost* host_process = root_rwh->GetProcess(); | 6268 RenderProcessHost* host_process = root_rwh->GetProcess(); |
| 6413 crash_renderer_and_wait_for_input_state_none(host_process); | 6269 crash_renderer_and_wait_for_input_state_none(host_process); |
| 6414 } | 6270 } |
| 6415 | 6271 |
| 6416 } // namespace content | 6272 } // namespace content |
| OLD | NEW |