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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 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_job_unittest.cc
diff --git a/content/browser/service_worker/service_worker_job_unittest.cc b/content/browser/service_worker/service_worker_job_unittest.cc
index 5938ee6512dd697ba26e800dece652090df6533b..bc31152cd2707b2599bb2d92338ccd1dbb6e5bde 100644
--- a/content/browser/service_worker/service_worker_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -183,7 +183,7 @@ scoped_refptr<ServiceWorkerRegistration> ServiceWorkerJobTest::RunRegisterJob(
scoped_refptr<ServiceWorkerRegistration> registration;
bool called;
job_coordinator()->Register(
- pattern, script_url, NULL,
+ script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
SaveRegistration(expected_status, &called, &registration));
EXPECT_FALSE(called);
base::RunLoop().RunUntilIdle();
@@ -277,16 +277,16 @@ TEST_F(ServiceWorkerJobTest, DifferentMatchDifferentRegistration) {
bool called1;
scoped_refptr<ServiceWorkerRegistration> original_registration1;
job_coordinator()->Register(
- GURL("http://www.example.com/one/"),
GURL("http://www.example.com/service_worker.js"),
+ ServiceWorkerRegistrationOptions(GURL("http://www.example.com/one/")),
NULL,
SaveRegistration(SERVICE_WORKER_OK, &called1, &original_registration1));
bool called2;
scoped_refptr<ServiceWorkerRegistration> original_registration2;
job_coordinator()->Register(
- GURL("http://www.example.com/two/"),
GURL("http://www.example.com/service_worker.js"),
+ ServiceWorkerRegistrationOptions(GURL("http://www.example.com/two/")),
NULL,
SaveRegistration(SERVICE_WORKER_OK, &called2, &original_registration2));
@@ -468,9 +468,7 @@ TEST_F(ServiceWorkerJobTest, ParallelRegUnreg) {
bool registration_called = false;
scoped_refptr<ServiceWorkerRegistration> registration;
job_coordinator()->Register(
- pattern,
- script_url,
- NULL,
+ script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
SaveRegistration(SERVICE_WORKER_OK, &registration_called, &registration));
bool unregistration_called = false;
@@ -500,21 +498,17 @@ TEST_F(ServiceWorkerJobTest, ParallelRegNewScript) {
bool registration1_called = false;
scoped_refptr<ServiceWorkerRegistration> registration1;
job_coordinator()->Register(
- pattern,
- script_url1,
- NULL,
- SaveRegistration(
- SERVICE_WORKER_OK, &registration1_called, &registration1));
+ script_url1, ServiceWorkerRegistrationOptions(pattern), NULL,
+ SaveRegistration(SERVICE_WORKER_OK, &registration1_called,
+ &registration1));
GURL script_url2("http://www.example.com/service_worker2.js");
bool registration2_called = false;
scoped_refptr<ServiceWorkerRegistration> registration2;
job_coordinator()->Register(
- pattern,
- script_url2,
- NULL,
- SaveRegistration(
- SERVICE_WORKER_OK, &registration2_called, &registration2));
+ script_url2, ServiceWorkerRegistrationOptions(pattern), NULL,
+ SaveRegistration(SERVICE_WORKER_OK, &registration2_called,
+ &registration2));
ASSERT_FALSE(registration1_called);
ASSERT_FALSE(registration2_called);
@@ -538,20 +532,16 @@ TEST_F(ServiceWorkerJobTest, ParallelRegSameScript) {
bool registration1_called = false;
scoped_refptr<ServiceWorkerRegistration> registration1;
job_coordinator()->Register(
- pattern,
- script_url,
- NULL,
- SaveRegistration(
- SERVICE_WORKER_OK, &registration1_called, &registration1));
+ script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
+ SaveRegistration(SERVICE_WORKER_OK, &registration1_called,
+ &registration1));
bool registration2_called = false;
scoped_refptr<ServiceWorkerRegistration> registration2;
job_coordinator()->Register(
- pattern,
- script_url,
- NULL,
- SaveRegistration(
- SERVICE_WORKER_OK, &registration2_called, &registration2));
+ script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
+ SaveRegistration(SERVICE_WORKER_OK, &registration2_called,
+ &registration2));
ASSERT_FALSE(registration1_called);
ASSERT_FALSE(registration2_called);
@@ -608,20 +598,16 @@ TEST_F(ServiceWorkerJobTest, AbortAll_Register) {
bool registration_called1 = false;
scoped_refptr<ServiceWorkerRegistration> registration1;
job_coordinator()->Register(
- pattern1,
- script_url1,
- NULL,
- SaveRegistration(SERVICE_WORKER_ERROR_ABORT,
- &registration_called1, &registration1));
+ script_url1, ServiceWorkerRegistrationOptions(pattern1), NULL,
+ SaveRegistration(SERVICE_WORKER_ERROR_ABORT, &registration_called1,
+ &registration1));
bool registration_called2 = false;
scoped_refptr<ServiceWorkerRegistration> registration2;
job_coordinator()->Register(
- pattern2,
- script_url2,
- NULL,
- SaveRegistration(SERVICE_WORKER_ERROR_ABORT,
- &registration_called2, &registration2));
+ script_url2, ServiceWorkerRegistrationOptions(pattern2), NULL,
+ SaveRegistration(SERVICE_WORKER_ERROR_ABORT, &registration_called2,
+ &registration2));
ASSERT_FALSE(registration_called1);
ASSERT_FALSE(registration_called2);
@@ -683,11 +669,9 @@ TEST_F(ServiceWorkerJobTest, AbortAll_RegUnreg) {
bool registration_called = false;
scoped_refptr<ServiceWorkerRegistration> registration;
job_coordinator()->Register(
- pattern,
- script_url,
- NULL,
- SaveRegistration(SERVICE_WORKER_ERROR_ABORT,
- &registration_called, &registration));
+ script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
+ SaveRegistration(SERVICE_WORKER_ERROR_ABORT, &registration_called,
+ &registration));
bool unregistration_called = false;
job_coordinator()->Unregister(
@@ -882,9 +866,8 @@ class UpdateJobTestHelper
scoped_refptr<ServiceWorkerRegistration> registration;
bool called = false;
job_coordinator()->Register(
- test_origin.Resolve(kScope),
test_origin.Resolve(kScript),
- NULL,
+ ServiceWorkerRegistrationOptions(test_origin.Resolve(kScope)), NULL,
SaveRegistration(SERVICE_WORKER_OK, &called, &registration));
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(called);

Powered by Google App Engine
This is Rietveld 408576698