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

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

Issue 1315483002: Service workers: Allow HTTPS pages arrived at via HTTP redirect to use SW (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittest Created 5 years, 4 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 | « content/browser/service_worker/service_worker_request_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_request_handler_unittest.cc
diff --git a/content/browser/service_worker/service_worker_request_handler_unittest.cc b/content/browser/service_worker/service_worker_request_handler_unittest.cc
index ea8b9a8e3fd036fd17a88a4a240e0418cd90ca23..eea2edf6f32b2cd0e705bcacf8c1cb73be8f49b2 100644
--- a/content/browser/service_worker/service_worker_request_handler_unittest.cc
+++ b/content/browser/service_worker/service_worker_request_handler_unittest.cc
@@ -113,10 +113,11 @@ class ServiceWorkerRequestHandlerTest : public testing::Test {
TEST_F(ServiceWorkerRequestHandlerTest, InitializeHandler) {
// Cannot initialize a handler for non-secure origins.
- EXPECT_FALSE(InitializeHandlerCheck("http://host/scope/doc", "GET", false,
- RESOURCE_TYPE_MAIN_FRAME));
EXPECT_FALSE(InitializeHandlerCheck(
"ftp://host/scope/doc", "GET", false, RESOURCE_TYPE_MAIN_FRAME));
+ // HTTP is ok because it might redirect to HTTPS.
+ EXPECT_TRUE(InitializeHandlerCheck("http://host/scope/doc", "GET", false,
+ RESOURCE_TYPE_MAIN_FRAME));
EXPECT_TRUE(InitializeHandlerCheck("https://host/scope/doc", "GET", false,
RESOURCE_TYPE_MAIN_FRAME));
@@ -124,26 +125,30 @@ TEST_F(ServiceWorkerRequestHandlerTest, InitializeHandler) {
EXPECT_TRUE(InitializeHandlerCheck(
"https://host/scope/doc", "OPTIONS", false, RESOURCE_TYPE_MAIN_FRAME));
+ // Check provider host's URL after initializing a handler for main
+ // frame.
provider_host_->SetDocumentUrl(GURL(""));
EXPECT_FALSE(InitializeHandlerCheck(
"http://host/scope/doc", "GET", true, RESOURCE_TYPE_MAIN_FRAME));
- // Cannot initialize a handler for non-secure origins.
- EXPECT_STREQ("", provider_host_->document_url().spec().c_str());
+ EXPECT_STREQ("http://host/scope/doc",
+ provider_host_->document_url().spec().c_str());
EXPECT_FALSE(InitializeHandlerCheck(
"https://host/scope/doc", "GET", true, RESOURCE_TYPE_MAIN_FRAME));
EXPECT_STREQ("https://host/scope/doc",
provider_host_->document_url().spec().c_str());
+ // Check provider host's URL after initializing a handler for a subframe.
provider_host_->SetDocumentUrl(GURL(""));
EXPECT_FALSE(InitializeHandlerCheck(
"http://host/scope/doc", "GET", true, RESOURCE_TYPE_SUB_FRAME));
- // Cannot initialize a handler for non-secure origins.
- EXPECT_STREQ("", provider_host_->document_url().spec().c_str());
+ EXPECT_STREQ("http://host/scope/doc",
+ provider_host_->document_url().spec().c_str());
EXPECT_FALSE(InitializeHandlerCheck(
"https://host/scope/doc", "GET", true, RESOURCE_TYPE_SUB_FRAME));
EXPECT_STREQ("https://host/scope/doc",
provider_host_->document_url().spec().c_str());
+ // Check provider host's URL after initializing a handler for an image.
provider_host_->SetDocumentUrl(GURL(""));
EXPECT_FALSE(InitializeHandlerCheck(
"http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE));
« no previous file with comments | « content/browser/service_worker/service_worker_request_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698