| 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 shell()->web_contents()->GetController().ReloadDisableLoFi(true); | 748 shell()->web_contents()->GetController().ReloadDisableLoFi(true); |
| 749 tab_observer.Wait(); | 749 tab_observer.Wait(); |
| 750 CheckResourcesRequested(false); | 750 CheckResourcesRequested(false); |
| 751 } | 751 } |
| 752 | 752 |
| 753 namespace { | 753 namespace { |
| 754 | 754 |
| 755 struct RequestDataForDelegate { | 755 struct RequestDataForDelegate { |
| 756 const GURL url; | 756 const GURL url; |
| 757 const GURL first_party; | 757 const GURL first_party; |
| 758 const url::Origin initiator; | 758 const base::Optional<url::Origin> initiator; |
| 759 | 759 |
| 760 RequestDataForDelegate(const GURL& url, | 760 RequestDataForDelegate(const GURL& url, |
| 761 const GURL& first_party, | 761 const GURL& first_party, |
| 762 const url::Origin initiator) | 762 const base::Optional<url::Origin>& initiator) |
| 763 : url(url), first_party(first_party), initiator(initiator) {} | 763 : url(url), first_party(first_party), initiator(initiator) {} |
| 764 }; | 764 }; |
| 765 | 765 |
| 766 // Captures calls to 'RequestBeginning' and records the URL, first-party for | 766 // Captures calls to 'RequestBeginning' and records the URL, first-party for |
| 767 // cookies, and initiator. | 767 // cookies, and initiator. |
| 768 class RequestDataResourceDispatcherHostDelegate | 768 class RequestDataResourceDispatcherHostDelegate |
| 769 : public ResourceDispatcherHostDelegate { | 769 : public ResourceDispatcherHostDelegate { |
| 770 public: | 770 public: |
| 771 RequestDataResourceDispatcherHostDelegate() {} | 771 RequestDataResourceDispatcherHostDelegate() {} |
| 772 | 772 |
| (...skipping 254 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 |