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