| 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/public/browser/resource_dispatcher_host.h" | 5 #include "content/public/browser/resource_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "content/browser/download/download_manager_impl.h" | 19 #include "content/browser/download/download_manager_impl.h" |
| 20 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 20 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 21 #include "content/browser/web_contents/web_contents_impl.h" | 21 #include "content/browser/web_contents/web_contents_impl.h" |
| 22 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 24 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 25 #include "content/public/browser/resource_request_info.h" | 25 #include "content/public/browser/resource_request_info.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/browser_side_navigation_policy.h" |
| 27 #include "content/public/common/url_constants.h" | 28 #include "content/public/common/url_constants.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 29 #include "content/public/test/browser_test_utils.h" |
| 29 #include "content/public/test/content_browser_test.h" | 30 #include "content/public/test/content_browser_test.h" |
| 30 #include "content/public/test/content_browser_test_utils.h" | 31 #include "content/public/test/content_browser_test_utils.h" |
| 31 #include "content/public/test/test_navigation_observer.h" | 32 #include "content/public/test/test_navigation_observer.h" |
| 32 #include "content/public/test/test_utils.h" | 33 #include "content/public/test/test_utils.h" |
| 33 #include "content/shell/browser/shell.h" | 34 #include "content/shell/browser/shell.h" |
| 34 #include "content/shell/browser/shell_content_browser_client.h" | 35 #include "content/shell/browser/shell_content_browser_client.h" |
| 35 #include "content/shell/browser/shell_network_delegate.h" | 36 #include "content/shell/browser/shell_network_delegate.h" |
| 36 #include "net/base/net_errors.h" | 37 #include "net/base/net_errors.h" |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 GURL top_url(embedded_test_server()->GetURL("/page_with_subresources.html")); | 873 GURL top_url(embedded_test_server()->GetURL("/page_with_subresources.html")); |
| 873 url::Origin top_origin(top_url); | 874 url::Origin top_origin(top_url); |
| 874 | 875 |
| 875 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); | 876 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); |
| 876 | 877 |
| 877 EXPECT_EQ(8u, delegate_->data().size()); | 878 EXPECT_EQ(8u, delegate_->data().size()); |
| 878 | 879 |
| 879 // All resources loaded directly by the top-level document (including the | 880 // All resources loaded directly by the top-level document (including the |
| 880 // top-level document itself) should have a |first_party| and |initiator| | 881 // top-level document itself) should have a |first_party| and |initiator| |
| 881 // that match the URL of the top-level document. | 882 // that match the URL of the top-level document. |
| 882 for (auto* request : delegate_->data()) { | 883 // PlzNavigate: the document itself should have an empty initiator. |
| 883 SCOPED_TRACE(request->url); | 884 if (IsBrowserSideNavigationEnabled()) { |
| 884 EXPECT_EQ(top_url, request->first_party); | 885 const RequestDataForDelegate* first_request = delegate_->data()[0]; |
| 885 EXPECT_EQ(top_origin, request->initiator); | 886 EXPECT_EQ(top_url, first_request->first_party); |
| 887 EXPECT_FALSE(first_request->initiator.has_value()); |
| 888 for (size_t i = 1; i < delegate_->data().size(); i++) { |
| 889 const RequestDataForDelegate* request = delegate_->data()[i]; |
| 890 EXPECT_EQ(top_url, request->first_party); |
| 891 ASSERT_TRUE(request->initiator.has_value()); |
| 892 EXPECT_EQ(top_origin, request->initiator); |
| 893 } |
| 894 } else { |
| 895 for (auto* request : delegate_->data()) { |
| 896 SCOPED_TRACE(request->url); |
| 897 EXPECT_EQ(top_url, request->first_party); |
| 898 EXPECT_EQ(top_origin, request->initiator); |
| 899 } |
| 886 } | 900 } |
| 887 } | 901 } |
| 888 | 902 |
| 889 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, | 903 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, |
| 890 BasicCrossSite) { | 904 BasicCrossSite) { |
| 891 host_resolver()->AddRule("*", "127.0.0.1"); | 905 host_resolver()->AddRule("*", "127.0.0.1"); |
| 892 GURL top_url(embedded_test_server()->GetURL( | 906 GURL top_url(embedded_test_server()->GetURL( |
| 893 "a.com", "/nested_page_with_subresources.html")); | 907 "a.com", "/nested_page_with_subresources.html")); |
| 894 GURL nested_url(embedded_test_server()->GetURL( | 908 GURL nested_url(embedded_test_server()->GetURL( |
| 895 "not-a.com", "/page_with_subresources.html")); | 909 "not-a.com", "/page_with_subresources.html")); |
| 896 url::Origin top_origin(top_url); | 910 url::Origin top_origin(top_url); |
| 897 url::Origin nested_origin(nested_url); | 911 url::Origin nested_origin(nested_url); |
| 898 | 912 |
| 899 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); | 913 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); |
| 900 | 914 |
| 901 EXPECT_EQ(9u, delegate_->data().size()); | 915 EXPECT_EQ(9u, delegate_->data().size()); |
| 902 | 916 |
| 903 // The first items loaded are the top-level and nested documents. These should | 917 // The first items loaded are the top-level and nested documents. These should |
| 904 // both have a |first_party| and |initiator| that match the URL of the | 918 // both have a |first_party| and |initiator| that match the URL of the |
| 905 // top-level document: | 919 // top-level document. |
| 920 // PlzNavigate: the top-level initiator is null. |
| 906 EXPECT_EQ(top_url, delegate_->data()[0]->url); | 921 EXPECT_EQ(top_url, delegate_->data()[0]->url); |
| 907 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); | 922 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); |
| 908 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); | 923 if (IsBrowserSideNavigationEnabled()) { |
| 924 EXPECT_FALSE(delegate_->data()[0]->initiator.has_value()); |
| 925 } else { |
| 926 ASSERT_TRUE(delegate_->data()[0]->initiator.has_value()); |
| 927 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); |
| 928 } |
| 909 | 929 |
| 910 EXPECT_EQ(nested_url, delegate_->data()[1]->url); | 930 EXPECT_EQ(nested_url, delegate_->data()[1]->url); |
| 911 EXPECT_EQ(top_url, delegate_->data()[1]->first_party); | 931 EXPECT_EQ(top_url, delegate_->data()[1]->first_party); |
| 912 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); | 932 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); |
| 913 | 933 |
| 914 // The remaining items are loaded as subresources in the nested document, and | 934 // The remaining items are loaded as subresources in the nested document, and |
| 915 // should have a unique first-party, and an initiator that matches the | 935 // should have a unique first-party, and an initiator that matches the |
| 916 // document in which they're embedded. | 936 // document in which they're embedded. |
| 917 for (size_t i = 2; i < delegate_->data().size(); i++) { | 937 for (size_t i = 2; i < delegate_->data().size(); i++) { |
| 918 SCOPED_TRACE(delegate_->data()[i]->url); | 938 SCOPED_TRACE(delegate_->data()[i]->url); |
| 919 EXPECT_EQ(kURLWithUniqueOrigin, delegate_->data()[i]->first_party); | 939 EXPECT_EQ(kURLWithUniqueOrigin, delegate_->data()[i]->first_party); |
| 920 EXPECT_EQ(nested_origin, delegate_->data()[i]->initiator); | 940 EXPECT_EQ(nested_origin, delegate_->data()[i]->initiator); |
| 921 } | 941 } |
| 922 } | 942 } |
| 923 | 943 |
| 924 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, | 944 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, |
| 925 SameOriginNested) { | 945 SameOriginNested) { |
| 926 GURL top_url(embedded_test_server()->GetURL("/page_with_iframe.html")); | 946 GURL top_url(embedded_test_server()->GetURL("/page_with_iframe.html")); |
| 927 GURL image_url(embedded_test_server()->GetURL("/image.jpg")); | 947 GURL image_url(embedded_test_server()->GetURL("/image.jpg")); |
| 928 GURL nested_url(embedded_test_server()->GetURL("/title1.html")); | 948 GURL nested_url(embedded_test_server()->GetURL("/title1.html")); |
| 929 url::Origin top_origin(top_url); | 949 url::Origin top_origin(top_url); |
| 930 | 950 |
| 931 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); | 951 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); |
| 932 | 952 |
| 933 EXPECT_EQ(3u, delegate_->data().size()); | 953 EXPECT_EQ(3u, delegate_->data().size()); |
| 934 | 954 |
| 935 // User-initiated top-level navigations have a first-party and initiator that | 955 // User-initiated top-level navigations have a first-party and initiator that |
| 936 // matches the URL to which they navigate. | 956 // matches the URL to which they navigate. |
| 957 // PlzNavigate: the top-level initiator is null. |
| 937 EXPECT_EQ(top_url, delegate_->data()[0]->url); | 958 EXPECT_EQ(top_url, delegate_->data()[0]->url); |
| 938 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); | 959 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); |
| 939 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); | 960 if (IsBrowserSideNavigationEnabled()) { |
| 961 EXPECT_FALSE(delegate_->data()[0]->initiator.has_value()); |
| 962 } else { |
| 963 ASSERT_TRUE(delegate_->data()[0]->initiator.has_value()); |
| 964 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); |
| 965 } |
| 940 | 966 |
| 941 // Subresource requests have a first-party and initiator that matches the | 967 // Subresource requests have a first-party and initiator that matches the |
| 942 // document in which they're embedded. | 968 // document in which they're embedded. |
| 943 EXPECT_EQ(image_url, delegate_->data()[1]->url); | 969 EXPECT_EQ(image_url, delegate_->data()[1]->url); |
| 944 EXPECT_EQ(top_url, delegate_->data()[1]->first_party); | 970 EXPECT_EQ(top_url, delegate_->data()[1]->first_party); |
| 945 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); | 971 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); |
| 946 | 972 |
| 947 // Same-origin nested frames have a first-party and initiator that matches | 973 // Same-origin nested frames have a first-party and initiator that matches |
| 948 // the document in which they're embedded. | 974 // the document in which they're embedded. |
| 949 EXPECT_EQ(nested_url, delegate_->data()[2]->url); | 975 EXPECT_EQ(nested_url, delegate_->data()[2]->url); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 966 "window.domAutomationController.send(clickSameSiteNewWindowLink());", | 992 "window.domAutomationController.send(clickSameSiteNewWindowLink());", |
| 967 &success)); | 993 &success)); |
| 968 EXPECT_TRUE(success); | 994 EXPECT_TRUE(success); |
| 969 Shell* new_shell = new_shell_observer.GetShell(); | 995 Shell* new_shell = new_shell_observer.GetShell(); |
| 970 WaitForLoadStop(new_shell->web_contents()); | 996 WaitForLoadStop(new_shell->web_contents()); |
| 971 | 997 |
| 972 EXPECT_EQ(2u, delegate_->data().size()); | 998 EXPECT_EQ(2u, delegate_->data().size()); |
| 973 | 999 |
| 974 // User-initiated top-level navigations have a first-party and initiator that | 1000 // User-initiated top-level navigations have a first-party and initiator that |
| 975 // matches the URL to which they navigate, even if they fail to load. | 1001 // matches the URL to which they navigate, even if they fail to load. |
| 1002 // PlzNavigate: the top-level initiator is null. |
| 976 EXPECT_EQ(top_url, delegate_->data()[0]->url); | 1003 EXPECT_EQ(top_url, delegate_->data()[0]->url); |
| 977 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); | 1004 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); |
| 978 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); | 1005 if (IsBrowserSideNavigationEnabled()) { |
| 1006 EXPECT_FALSE(delegate_->data()[0]->initiator.has_value()); |
| 1007 } else { |
| 1008 ASSERT_TRUE(delegate_->data()[0]->initiator.has_value()); |
| 1009 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); |
| 1010 } |
| 979 | 1011 |
| 980 // Auxiliary navigations have a first-party that matches the URL to which they | 1012 // Auxiliary navigations have a first-party that matches the URL to which they |
| 981 // navigate, and an initiator that matches the document that triggered them. | 1013 // navigate, and an initiator that matches the document that triggered them. |
| 982 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->url); | 1014 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->url); |
| 983 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->first_party); | 1015 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->first_party); |
| 984 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); | 1016 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); |
| 985 } | 1017 } |
| 986 | 1018 |
| 987 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, | 1019 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, |
| 988 CrossOriginAuxiliary) { | 1020 CrossOriginAuxiliary) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1007 "window.domAutomationController.send(clickCrossSiteNewWindowLink());", | 1039 "window.domAutomationController.send(clickCrossSiteNewWindowLink());", |
| 1008 &success)); | 1040 &success)); |
| 1009 EXPECT_TRUE(success); | 1041 EXPECT_TRUE(success); |
| 1010 Shell* new_shell = new_shell_observer.GetShell(); | 1042 Shell* new_shell = new_shell_observer.GetShell(); |
| 1011 WaitForLoadStop(new_shell->web_contents()); | 1043 WaitForLoadStop(new_shell->web_contents()); |
| 1012 | 1044 |
| 1013 EXPECT_EQ(2u, delegate_->data().size()); | 1045 EXPECT_EQ(2u, delegate_->data().size()); |
| 1014 | 1046 |
| 1015 // User-initiated top-level navigations have a first-party and initiator that | 1047 // User-initiated top-level navigations have a first-party and initiator that |
| 1016 // matches the URL to which they navigate, even if they fail to load. | 1048 // matches the URL to which they navigate, even if they fail to load. |
| 1049 // PlzNavigate: the top-level initiator is null. |
| 1017 EXPECT_EQ(top_url, delegate_->data()[0]->url); | 1050 EXPECT_EQ(top_url, delegate_->data()[0]->url); |
| 1018 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); | 1051 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); |
| 1019 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); | 1052 if (IsBrowserSideNavigationEnabled()) { |
| 1053 EXPECT_FALSE(delegate_->data()[0]->initiator.has_value()); |
| 1054 } else { |
| 1055 ASSERT_TRUE(delegate_->data()[0]->initiator.has_value()); |
| 1056 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); |
| 1057 } |
| 1020 | 1058 |
| 1021 // Auxiliary navigations have a first-party that matches the URL to which they | 1059 // Auxiliary navigations have a first-party that matches the URL to which they |
| 1022 // navigate, and an initiator that matches the document that triggered them. | 1060 // navigate, and an initiator that matches the document that triggered them. |
| 1023 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->url); | 1061 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->url); |
| 1024 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->first_party); | 1062 EXPECT_EQ(auxiliary_url, delegate_->data()[1]->first_party); |
| 1025 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); | 1063 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); |
| 1026 } | 1064 } |
| 1027 | 1065 |
| 1028 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, | 1066 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, |
| 1029 FailedNavigation) { | 1067 FailedNavigation) { |
| 1030 // Navigating to this URL will fail, as we haven't taught the host resolver | 1068 // Navigating to this URL will fail, as we haven't taught the host resolver |
| 1031 // about 'a.com'. | 1069 // about 'a.com'. |
| 1032 GURL top_url(embedded_test_server()->GetURL("a.com", "/simple_page.html")); | 1070 GURL top_url(embedded_test_server()->GetURL("a.com", "/simple_page.html")); |
| 1033 url::Origin top_origin(top_url); | 1071 url::Origin top_origin(top_url); |
| 1034 | 1072 |
| 1035 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); | 1073 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); |
| 1036 | 1074 |
| 1037 EXPECT_EQ(1u, delegate_->data().size()); | 1075 EXPECT_EQ(1u, delegate_->data().size()); |
| 1038 | 1076 |
| 1039 // User-initiated top-level navigations have a first-party and initiator that | 1077 // User-initiated top-level navigations have a first-party and initiator that |
| 1040 // matches the URL to which they navigate, even if they fail to load. | 1078 // matches the URL to which they navigate, even if they fail to load. |
| 1079 // PlzNavigate: the top-level initiator is null. |
| 1041 EXPECT_EQ(top_url, delegate_->data()[0]->url); | 1080 EXPECT_EQ(top_url, delegate_->data()[0]->url); |
| 1042 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); | 1081 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); |
| 1043 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); | 1082 if (IsBrowserSideNavigationEnabled()) { |
| 1083 EXPECT_FALSE(delegate_->data()[0]->initiator.has_value()); |
| 1084 } else { |
| 1085 ASSERT_TRUE(delegate_->data()[0]->initiator.has_value()); |
| 1086 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); |
| 1087 } |
| 1044 } | 1088 } |
| 1045 | 1089 |
| 1046 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, | 1090 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, |
| 1047 CrossOriginNested) { | 1091 CrossOriginNested) { |
| 1048 host_resolver()->AddRule("*", "127.0.0.1"); | 1092 host_resolver()->AddRule("*", "127.0.0.1"); |
| 1049 GURL top_url(embedded_test_server()->GetURL( | 1093 GURL top_url(embedded_test_server()->GetURL( |
| 1050 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 1094 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 1051 GURL top_js_url( | 1095 GURL top_js_url( |
| 1052 embedded_test_server()->GetURL("a.com", "/tree_parser_util.js")); | 1096 embedded_test_server()->GetURL("a.com", "/tree_parser_util.js")); |
| 1053 GURL nested_url(embedded_test_server()->GetURL( | 1097 GURL nested_url(embedded_test_server()->GetURL( |
| 1054 "b.com", "/cross_site_iframe_factory.html?b()")); | 1098 "b.com", "/cross_site_iframe_factory.html?b()")); |
| 1055 GURL nested_js_url( | 1099 GURL nested_js_url( |
| 1056 embedded_test_server()->GetURL("b.com", "/tree_parser_util.js")); | 1100 embedded_test_server()->GetURL("b.com", "/tree_parser_util.js")); |
| 1057 url::Origin top_origin(top_url); | 1101 url::Origin top_origin(top_url); |
| 1058 url::Origin nested_origin(nested_url); | 1102 url::Origin nested_origin(nested_url); |
| 1059 | 1103 |
| 1060 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); | 1104 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); |
| 1061 | 1105 |
| 1062 EXPECT_EQ(4u, delegate_->data().size()); | 1106 EXPECT_EQ(4u, delegate_->data().size()); |
| 1063 | 1107 |
| 1064 // User-initiated top-level navigations have a first-party and initiator that | 1108 // User-initiated top-level navigations have a first-party and initiator that |
| 1065 // matches the URL to which they navigate. | 1109 // matches the URL to which they navigate. |
| 1110 // PlzNavigate: the top-level initiator is null. |
| 1066 EXPECT_EQ(top_url, delegate_->data()[0]->url); | 1111 EXPECT_EQ(top_url, delegate_->data()[0]->url); |
| 1067 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); | 1112 EXPECT_EQ(top_url, delegate_->data()[0]->first_party); |
| 1068 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); | 1113 if (IsBrowserSideNavigationEnabled()) { |
| 1114 EXPECT_FALSE(delegate_->data()[0]->initiator.has_value()); |
| 1115 } else { |
| 1116 ASSERT_TRUE(delegate_->data()[0]->initiator.has_value()); |
| 1117 EXPECT_EQ(top_origin, delegate_->data()[0]->initiator); |
| 1118 } |
| 1069 | 1119 |
| 1070 EXPECT_EQ(top_js_url, delegate_->data()[1]->url); | 1120 EXPECT_EQ(top_js_url, delegate_->data()[1]->url); |
| 1071 EXPECT_EQ(top_url, delegate_->data()[1]->first_party); | 1121 EXPECT_EQ(top_url, delegate_->data()[1]->first_party); |
| 1072 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); | 1122 EXPECT_EQ(top_origin, delegate_->data()[1]->initiator); |
| 1073 | 1123 |
| 1074 // Cross-origin frames have a first-party and initiator that matches the URL | 1124 // Cross-origin frames have a first-party and initiator that matches the URL |
| 1075 // in which they're embedded. | 1125 // in which they're embedded. |
| 1076 EXPECT_EQ(nested_url, delegate_->data()[2]->url); | 1126 EXPECT_EQ(nested_url, delegate_->data()[2]->url); |
| 1077 EXPECT_EQ(top_url, delegate_->data()[2]->first_party); | 1127 EXPECT_EQ(top_url, delegate_->data()[2]->first_party); |
| 1078 EXPECT_EQ(top_origin, delegate_->data()[2]->initiator); | 1128 EXPECT_EQ(top_origin, delegate_->data()[2]->initiator); |
| 1079 | 1129 |
| 1080 // Cross-origin subresource requests have a unique first-party, and an | 1130 // Cross-origin subresource requests have a unique first-party, and an |
| 1081 // initiator that matches the document in which they're embedded. | 1131 // initiator that matches the document in which they're embedded. |
| 1082 EXPECT_EQ(nested_js_url, delegate_->data()[3]->url); | 1132 EXPECT_EQ(nested_js_url, delegate_->data()[3]->url); |
| 1083 EXPECT_EQ(kURLWithUniqueOrigin, delegate_->data()[3]->first_party); | 1133 EXPECT_EQ(kURLWithUniqueOrigin, delegate_->data()[3]->first_party); |
| 1084 EXPECT_EQ(nested_origin, delegate_->data()[3]->initiator); | 1134 EXPECT_EQ(nested_origin, delegate_->data()[3]->initiator); |
| 1085 } | 1135 } |
| 1086 | 1136 |
| 1087 } // namespace content | 1137 } // namespace content |
| OLD | NEW |