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" |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 GURL top_url(embedded_test_server()->GetURL("/page_with_subresources.html")); | 821 GURL top_url(embedded_test_server()->GetURL("/page_with_subresources.html")); |
822 url::Origin top_origin(top_url); | 822 url::Origin top_origin(top_url); |
823 | 823 |
824 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); | 824 NavigateToURLBlockUntilNavigationsComplete(shell(), top_url, 1); |
825 | 825 |
826 EXPECT_EQ(8u, delegate_->data().size()); | 826 EXPECT_EQ(8u, delegate_->data().size()); |
827 | 827 |
828 // All resources loaded directly by the top-level document (including the | 828 // All resources loaded directly by the top-level document (including the |
829 // top-level document itself) should have a |first_party| and |initiator| | 829 // top-level document itself) should have a |first_party| and |initiator| |
830 // that match the URL of the top-level document. | 830 // that match the URL of the top-level document. |
831 for (const auto& request : delegate_->data()) { | 831 for (auto* request : delegate_->data()) { |
832 SCOPED_TRACE(request->url); | 832 SCOPED_TRACE(request->url); |
833 EXPECT_EQ(top_url, request->first_party); | 833 EXPECT_EQ(top_url, request->first_party); |
834 EXPECT_EQ(top_origin, request->initiator); | 834 EXPECT_EQ(top_origin, request->initiator); |
835 } | 835 } |
836 } | 836 } |
837 | 837 |
838 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, | 838 IN_PROC_BROWSER_TEST_F(RequestDataResourceDispatcherHostBrowserTest, |
839 BasicCrossSite) { | 839 BasicCrossSite) { |
840 host_resolver()->AddRule("*", "127.0.0.1"); | 840 host_resolver()->AddRule("*", "127.0.0.1"); |
841 GURL top_url(embedded_test_server()->GetURL( | 841 GURL top_url(embedded_test_server()->GetURL( |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 EXPECT_EQ(top_origin, delegate_->data()[2]->initiator); | 1027 EXPECT_EQ(top_origin, delegate_->data()[2]->initiator); |
1028 | 1028 |
1029 // Cross-origin subresource requests have a unique first-party, and an | 1029 // Cross-origin subresource requests have a unique first-party, and an |
1030 // initiator that matches the document in which they're embedded. | 1030 // initiator that matches the document in which they're embedded. |
1031 EXPECT_EQ(nested_js_url, delegate_->data()[3]->url); | 1031 EXPECT_EQ(nested_js_url, delegate_->data()[3]->url); |
1032 EXPECT_EQ(kURLWithUniqueOrigin, delegate_->data()[3]->first_party); | 1032 EXPECT_EQ(kURLWithUniqueOrigin, delegate_->data()[3]->first_party); |
1033 EXPECT_EQ(nested_origin, delegate_->data()[3]->initiator); | 1033 EXPECT_EQ(nested_origin, delegate_->data()[3]->initiator); |
1034 } | 1034 } |
1035 | 1035 |
1036 } // namespace content | 1036 } // namespace content |
OLD | NEW |