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

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

Issue 2071433003: Reland: service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revised Created 4 years, 6 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
Index: content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
index c31d4ba80ae561433f8cdb5090472816a7b01961..918627f74581ede10797a90d3918c9c4c80d5f24 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc
@@ -105,8 +105,8 @@ class ServiceWorkerControlleeRequestHandlerTest : public testing::Test {
helper_.reset(helper);
// A new unstored registration/version.
- scope_ = GURL("http://host/scope/");
- script_url_ = GURL("http://host/script.js");
+ scope_ = GURL("https://host/scope/");
+ script_url_ = GURL("https://host/script.js");
registration_ = new ServiceWorkerRegistration(
scope_, 1L, context()->AsWeakPtr());
version_ = new ServiceWorkerVersion(
@@ -119,10 +119,11 @@ class ServiceWorkerControlleeRequestHandlerTest : public testing::Test {
// An empty host.
std::unique_ptr<ServiceWorkerProviderHost> host(
- new ServiceWorkerProviderHost(helper_->mock_render_process_id(),
- MSG_ROUTING_NONE, kMockProviderId,
- SERVICE_WORKER_PROVIDER_FOR_WINDOW,
- context()->AsWeakPtr(), NULL));
+ new ServiceWorkerProviderHost(
+ helper_->mock_render_process_id(), MSG_ROUTING_NONE,
+ kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
+ ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
+ context()->AsWeakPtr(), NULL));
provider_host_ = host->AsWeakPtr();
context()->AddProviderHost(std::move(host));
@@ -180,7 +181,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, DisallowServiceWorker) {
// Conduct a main resource load.
ServiceWorkerRequestTestResources test_resources(
- this, GURL("http://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
+ this, GURL("https://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
ServiceWorkerURLRequestJob* sw_job = test_resources.MaybeCreateJob();
EXPECT_FALSE(sw_job->ShouldFallbackToNetwork());
@@ -209,7 +210,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, ActivateWaitingVersion) {
// Conduct a main resource load.
ServiceWorkerRequestTestResources test_resources(
- this, GURL("http://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
+ this, GURL("https://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
ServiceWorkerURLRequestJob* sw_job = test_resources.MaybeCreateJob();
EXPECT_FALSE(sw_job->ShouldFallbackToNetwork());
@@ -239,7 +240,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, InstallingRegistration) {
// Conduct a main resource load.
ServiceWorkerRequestTestResources test_resources(
- this, GURL("http://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
+ this, GURL("https://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
ServiceWorkerURLRequestJob* job = test_resources.MaybeCreateJob();
base::RunLoop().RunUntilIdle();
@@ -271,7 +272,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, DeletedProviderHost) {
// Conduct a main resource load.
ServiceWorkerRequestTestResources test_resources(
- this, GURL("http://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
+ this, GURL("https://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
ServiceWorkerURLRequestJob* sw_job = test_resources.MaybeCreateJob();
EXPECT_FALSE(sw_job->ShouldFallbackToNetwork());
@@ -297,7 +298,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, FallbackWithNoFetchHandler) {
base::RunLoop().RunUntilIdle();
ServiceWorkerRequestTestResources main_test_resources(
- this, GURL("http://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
+ this, GURL("https://host/scope/doc"), RESOURCE_TYPE_MAIN_FRAME);
ServiceWorkerURLRequestJob* main_job = main_test_resources.MaybeCreateJob();
EXPECT_FALSE(main_job->ShouldFallbackToNetwork());
@@ -312,7 +313,7 @@ TEST_F(ServiceWorkerControlleeRequestHandlerTest, FallbackWithNoFetchHandler) {
EXPECT_EQ(version_, provider_host_->controlling_version());
ServiceWorkerRequestTestResources sub_test_resources(
- this, GURL("http://host/scope/doc/subresource"), RESOURCE_TYPE_IMAGE);
+ this, GURL("https://host/scope/doc/subresource"), RESOURCE_TYPE_IMAGE);
ServiceWorkerURLRequestJob* sub_job = sub_test_resources.MaybeCreateJob();
// This job shouldn't be created because this worker doesn't have fetch

Powered by Google App Engine
This is Rietveld 408576698