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

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

Issue 517493002: ServiceWorker: Update the install sequence as per the latest spec (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment fix (+rebase) 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 dd2c165450ba992171ef5f597408cdb37e27fc35..879316950dcfdf0e51cd5bba5ce2c78a43a10e23 100644
--- a/content/browser/service_worker/service_worker_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_job_unittest.cc
@@ -894,7 +894,8 @@ class UpdateJobTestHelper
};
UpdateJobTestHelper(int mock_render_process_id)
- : EmbeddedWorkerTestHelper(mock_render_process_id) {}
+ : EmbeddedWorkerTestHelper(mock_render_process_id),
+ update_found_(false) {}
virtual ~UpdateJobTestHelper() {
if (registration_.get())
registration_->RemoveListener(this);
@@ -972,6 +973,17 @@ class UpdateJobTestHelper
NOTREACHED();
}
+ virtual void OnRegistrationFinishedUninstalling(
+ ServiceWorkerRegistration* registration) OVERRIDE {
+ NOTREACHED();
+ }
+
+ virtual void OnUpdateFound(
+ ServiceWorkerRegistration* registration) OVERRIDE {
+ ASSERT_FALSE(update_found_);
+ update_found_ = true;
+ }
+
// ServiceWorkerVersion::Listener overrides
virtual void OnVersionStateChanged(ServiceWorkerVersion* version) OVERRIDE {
StateChangeLogEntry entry;
@@ -984,6 +996,7 @@ class UpdateJobTestHelper
std::vector<AttributeChangeLogEntry> attribute_change_log_;
std::vector<StateChangeLogEntry> state_change_log_;
+ bool update_found_;
};
} // namespace
@@ -1024,6 +1037,7 @@ TEST_F(ServiceWorkerJobTest, Update_NoChange) {
update_helper->state_change_log_[0].version_id);
EXPECT_EQ(ServiceWorkerVersion::REDUNDANT,
update_helper->state_change_log_[0].status);
+ EXPECT_FALSE(update_helper->update_found_);
}
TEST_F(ServiceWorkerJobTest, Update_NewVersion) {
@@ -1104,6 +1118,8 @@ TEST_F(ServiceWorkerJobTest, Update_NewVersion) {
update_helper->state_change_log_[4].version_id);
EXPECT_EQ(ServiceWorkerVersion::ACTIVATED,
update_helper->state_change_log_[4].status);
+
+ EXPECT_TRUE(update_helper->update_found_);
}
TEST_F(ServiceWorkerJobTest, Update_NewestVersionChanged) {

Powered by Google App Engine
This is Rietveld 408576698