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

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

Issue 417043006: ServiceWorker: Make SWProviderHost listen to SWRegistration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address michael's comments Created 6 years, 4 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 f9a2f2e8e641615f4d58cc73b64151fd1e8e039f..27af8eb3c8a9a1d60681f96f21c5e5ab4e22ecad 100644
--- a/content/browser/service_worker/service_worker_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -896,6 +896,10 @@ class UpdateJobTestHelper
UpdateJobTestHelper(int mock_render_process_id)
: EmbeddedWorkerTestHelper(mock_render_process_id) {}
+ virtual ~UpdateJobTestHelper() {
+ if (registration_)
+ registration_->RemoveListener(this);
+ }
ServiceWorkerStorage* storage() { return context()->storage(); }
ServiceWorkerJobCoordinator* job_coordinator() {
@@ -917,6 +921,7 @@ class UpdateJobTestHelper
EXPECT_TRUE(registration->active_version());
EXPECT_FALSE(registration->installing_version());
EXPECT_FALSE(registration->waiting_version());
+ registration_ = registration;
return registration;
}
@@ -963,6 +968,12 @@ class UpdateJobTestHelper
attribute_change_log_.push_back(entry);
}
+ virtual void OnRegistrationDeleted(
+ ServiceWorkerRegistration* registration) OVERRIDE {
+ registration_->RemoveListener(this);
+ registration_ = NULL;
+ }
+
// ServiceWorkerVersion::Listener overrides
virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE {
StateChangeLogEntry entry;
@@ -971,6 +982,8 @@ class UpdateJobTestHelper
state_change_log_.push_back(entry);
}
+ scoped_refptr<ServiceWorkerRegistration> registration_;
+
std::vector<AttributeChangeLogEntry> attribute_change_log_;
std::vector<StateChangeLogEntry> state_change_log_;
};

Powered by Google App Engine
This is Rietveld 408576698