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

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: fix tests Created 3 years, 9 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 0d235ec0b3461f666ec53a2d4398b6570c7d4637..5dd2e34ca40f2af65e54f11f5b0a813f6b348888 100644
--- a/content/browser/service_worker/service_worker_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -162,7 +162,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();
@@ -254,16 +254,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));
@@ -411,9 +411,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;
@@ -443,21 +441,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);
@@ -481,20 +475,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);
@@ -551,20 +541,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);
@@ -626,11 +612,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(
@@ -825,9 +809,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