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

Side by Side Diff: content/common/origin_util.cc

Issue 2157363004: Fix SecureOriginWhiteListTest.UnsafelyTreatInsecureOriginAsSecure to not leak test state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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
« no previous file with comments | « chrome/common/secure_origin_whitelist_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/common/origin_util.h" 5 #include "content/public/common/origin_util.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
11 #include "net/base/url_util.h" 11 #include "net/base/url_util.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace { 16 namespace {
17 17
18 class SchemeAndOriginWhitelist { 18 class SchemeAndOriginWhitelist {
19 public: 19 public:
20 SchemeAndOriginWhitelist() { Reset(); } 20 SchemeAndOriginWhitelist() { Reset(); }
21 ~SchemeAndOriginWhitelist() {} 21 ~SchemeAndOriginWhitelist() {}
22 22
23 void Reset() { 23 void Reset() {
24 secure_schemes_.clear();
25 secure_origins_.clear();
26 service_worker_schemes_.clear();
24 GetContentClient()->AddSecureSchemesAndOrigins(&secure_schemes_, 27 GetContentClient()->AddSecureSchemesAndOrigins(&secure_schemes_,
25 &secure_origins_); 28 &secure_origins_);
26 GetContentClient()->AddServiceWorkerSchemes(&service_worker_schemes_); 29 GetContentClient()->AddServiceWorkerSchemes(&service_worker_schemes_);
27 } 30 }
28 31
29 const std::set<std::string>& secure_schemes() const { 32 const std::set<std::string>& secure_schemes() const {
30 return secure_schemes_; 33 return secure_schemes_;
31 } 34 }
32 const std::set<GURL>& secure_origins() const { return secure_origins_; } 35 const std::set<GURL>& secure_origins() const { return secure_origins_; }
33 const std::set<std::string>& service_worker_schemes() const { 36 const std::set<std::string>& service_worker_schemes() const {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 83 }
81 84
82 return false; 85 return false;
83 } 86 }
84 87
85 void ResetSchemesAndOriginsWhitelistForTesting() { 88 void ResetSchemesAndOriginsWhitelistForTesting() {
86 g_trustworthy_whitelist.Get().Reset(); 89 g_trustworthy_whitelist.Get().Reset();
87 } 90 }
88 91
89 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/secure_origin_whitelist_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698