Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_browsertest.cc

Issue 2405483002: Make the request initiator Optional (Closed)
Patch Set: Addressed comments + rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/loader/async_revalidation_manager_unittest.cc ('k') | content/browser/loader/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698