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

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

Issue 1928443003: service worker: Update job gets the script url when the job starts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 77438a1be1d1a516dc8f05e74a8ce63e9e33f319..e947e28d94d518c27775a9733b0320bfcbb0c6be 100644
--- a/content/browser/service_worker/service_worker_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -1137,25 +1137,21 @@ TEST_F(ServiceWorkerJobTest, Update_NewestVersionChanged) {
RunRegisterJob(GURL("http://www.example.com/one/"),
GURL("http://www.example.com/service_worker.js"));
- ServiceWorkerVersion* active_version = registration->active_version();
-
- // Queue an Update, it should abort when it starts and sees the new version.
+ // Queue an Update. When this runs, it will use the waiting version's script.
job_coordinator()->Update(registration.get(), false);
// Add a waiting version with new script.
- scoped_refptr<ServiceWorkerVersion> version =
- new ServiceWorkerVersion(registration.get(),
- GURL("http://www.example.com/new_worker.js"),
- 2L /* dummy version id */,
- helper_->context()->AsWeakPtr());
+ const char* new_script = "http://www.example.com/new_worker.js";
+ scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion(
+ registration.get(), GURL(new_script), 2L /* dummy version id */,
+ helper_->context()->AsWeakPtr());
registration->SetWaitingVersion(version);
base::RunLoop().RunUntilIdle();
- // Verify the registration was not modified by the Update.
- EXPECT_EQ(active_version, registration->active_version());
- EXPECT_EQ(version.get(), registration->waiting_version());
- EXPECT_EQ(NULL, registration->installing_version());
+ EXPECT_EQ(new_script, registration->active_version()->script_url().spec());
+ EXPECT_EQ(nullptr, registration->waiting_version());
+ EXPECT_EQ(nullptr, registration->installing_version());
}
// Test that update succeeds if the incumbent worker was evicted

Powered by Google App Engine
This is Rietveld 408576698