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

Unified Diff: content/browser/service_worker/service_worker_provider_host_unittest.cc

Issue 2622693002: Cleanup of static lists of schemes & origins that are created at startup. (Closed)
Patch Set: merge Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/test/components_test_suite.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_provider_host_unittest.cc
diff --git a/content/browser/service_worker/service_worker_provider_host_unittest.cc b/content/browser/service_worker/service_worker_provider_host_unittest.cc
index 799c36da12d1d0bbdf671f0052480ecae715c148..9ecf53108b0e724a55036da7e5db1729f76e7db9 100644
--- a/content/browser/service_worker/service_worker_provider_host_unittest.cc
+++ b/content/browser/service_worker/service_worker_provider_host_unittest.cc
@@ -14,6 +14,7 @@
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_test_utils.h"
#include "content/browser/service_worker/service_worker_version.h"
+#include "content/common/url_schemes.h"
#include "content/public/common/origin_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/test/test_content_browser_client.h"
@@ -26,8 +27,8 @@ const char kServiceWorkerScheme[] = "i-can-use-service-worker";
class ServiceWorkerTestContentClient : public TestContentClient {
public:
- void AddServiceWorkerSchemes(std::set<std::string>* schemes) override {
- schemes->insert(kServiceWorkerScheme);
+ void AddAdditionalSchemes(Schemes* schemes) override {
+ schemes->service_worker_schemes.push_back(kServiceWorkerScheme);
}
};
@@ -42,6 +43,7 @@ class ServiceWorkerProviderHostTest : public testing::Test {
void SetUp() override {
old_content_browser_client_ =
SetBrowserClientForTesting(&test_content_browser_client_);
+ RefreshSecuritySchemesForTesting();
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
context_ = helper_->context();
@@ -79,13 +81,15 @@ class ServiceWorkerProviderHostTest : public testing::Test {
registration2_ = 0;
helper_.reset();
SetBrowserClientForTesting(old_content_browser_client_);
+ // Reset cached security schemes so we don't affect other tests.
+ RefreshSecuritySchemesForTesting();
}
bool PatternHasProcessToRun(const GURL& pattern) const {
return context_->process_manager()->PatternHasProcessToRun(pattern);
}
- content::TestBrowserThreadBundle thread_bundle_;
+ TestBrowserThreadBundle thread_bundle_;
std::unique_ptr<EmbeddedWorkerTestHelper> helper_;
ServiceWorkerContextCore* context_;
scoped_refptr<ServiceWorkerRegistration> registration1_;
@@ -169,7 +173,6 @@ TEST_F(ServiceWorkerProviderHostTest, MatchRegistration) {
TEST_F(ServiceWorkerProviderHostTest, ContextSecurity) {
using FrameSecurityLevel = ServiceWorkerProviderHost::FrameSecurityLevel;
- content::ResetSchemesAndOriginsWhitelistForTesting();
// Insecure document URL.
provider_host1_->SetDocumentUrl(GURL("http://host"));
« no previous file with comments | « components/test/components_test_suite.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698