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

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

Issue 996123002: ServiceWorker: Ensure live registration during starting worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 5 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_dispatcher_host_unittest.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
index d3ce47c3bec07b3de2deb1b34448e80001c5e058..c761f55be83c340d95c92e0b1644b96224acf1b4 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc
@@ -517,11 +517,24 @@ TEST_F(ServiceWorkerDispatcherHostTest, CleanupOnRendererCrash) {
GURL("http://www.example.com/service_worker.js"),
1L,
helper_->context()->AsWeakPtr()));
+
+ // Make the registration findable via storage functions.
+ helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing));
+ base::RunLoop().RunUntilIdle();
+ bool called = false;
+ ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_ABORT;
+ helper_->context()->storage()->StoreRegistration(
+ registration.get(),
+ version.get(),
+ base::Bind(&SaveStatusCallback, &called, &status));
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(called);
+ ASSERT_EQ(SERVICE_WORKER_OK, status);
+
helper_->SimulateAddProcessToPattern(pattern, kRenderProcessId);
// Start up the worker.
- bool called;
- ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_ABORT;
+ status = SERVICE_WORKER_ERROR_ABORT;
version->StartWorker(base::Bind(&SaveStatusCallback, &called, &status));
base::RunLoop().RunUntilIdle();

Powered by Google App Engine
This is Rietveld 408576698