const scoped_refptr<ServiceWorkerRegistration>& registration) {
ASSERT_EQ(expect_status, status);
if (status != SERVICE_WORKER_OK) {
- EXPECT_FALSE(registration);
+ EXPECT_FALSE(registration.get());
return;
}
context()->RegisterServiceWorker(
GURL("http://www.example.com/"),
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, ®istration_id, &version_id));
context()->RegisterServiceWorker(
GURL("http://www.example.com/"),
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, ®istration_id, &version_id));
context()->RegisterServiceWorker(
GURL("http://www.example.com/"),
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, ®istration_id, &version_id));
context()->RegisterServiceWorker(
pattern,
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, ®istration_id, &version_id));
base::RunLoop().RunUntilIdle();
}
-// Make sure that when a new registration replaces an existing
-// registration, that the old one is cleaned up.
+// Make sure registering a new script creates a new version and shares an
+// existing registration.
TEST_F(ServiceWorkerContextTest, RegisterNewScript) {
GURL pattern("http://www.example.com/");
context()->RegisterServiceWorker(
pattern,
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, &old_registration_id, &old_version_id));
context()->RegisterServiceWorker(
pattern,
GURL("http://www.example.com/service_worker_new.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, &new_registration_id, &new_version_id));
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(called);
- // Returned IDs should be valid, and should differ from the values
- // returned for the previous registration.
EXPECT_NE(kInvalidServiceWorkerRegistrationId, new_registration_id);
EXPECT_NE(kInvalidServiceWorkerVersionId, new_version_id);
- EXPECT_NE(old_registration_id, new_registration_id);
+ EXPECT_EQ(old_registration_id, new_registration_id);
EXPECT_NE(old_version_id, new_version_id);
}
context()->RegisterServiceWorker(
pattern,
script_url,
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, &old_registration_id, &old_version_id));
context()->RegisterServiceWorker(
pattern,
script_url,
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, &new_registration_id, &new_version_id));
context()->RegisterServiceWorker(
GURL("http://www.example.com/"),
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, ®istration_id, &version_id));
context()->RegisterServiceWorker(
GURL("http://www.example.com/"),
GURL("http://www.example.com/service_worker.js"),
- render_process_id_,
NULL,
MakeRegisteredCallback(&called, ®istration_id, &version_id));