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

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

Issue 805083006: Schedule the stop-worker-timer even if the ServiceWorker is controlling pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_version_unittest.cc
diff --git a/content/browser/service_worker/service_worker_version_unittest.cc b/content/browser/service_worker/service_worker_version_unittest.cc
index f6d4629d39d2bf4871066193c037fbc169b3599c..6196c86754d945e8b7db54e493503e7a95d902f5 100644
--- a/content/browser/service_worker/service_worker_version_unittest.cc
+++ b/content/browser/service_worker/service_worker_version_unittest.cc
@@ -381,7 +381,9 @@ TEST_F(ServiceWorkerVersionTest, ScheduleStopWorker) {
EXPECT_EQ(SERVICE_WORKER_OK, status);
EXPECT_TRUE(version_->stop_worker_timer_.IsRunning());
- // The timer should not be running if a controllee is added.
+ base::TimeDelta delay = version_->stop_worker_timer_.GetCurrentDelay();
+
+ // Adding controllee doesn't stop the stop-worker-timer, but...
scoped_ptr<ServiceWorkerProviderHost> host(
new ServiceWorkerProviderHost(33 /* dummy render process id */,
MSG_ROUTING_NONE /* render_frame_id */,
@@ -389,11 +391,11 @@ TEST_F(ServiceWorkerVersionTest, ScheduleStopWorker) {
helper_->context()->AsWeakPtr(),
NULL));
version_->AddControllee(host.get());
- EXPECT_FALSE(version_->stop_worker_timer_.IsRunning());
-
- // The timer should be running if the controllee is removed.
- version_->RemoveControllee(host.get());
EXPECT_TRUE(version_->stop_worker_timer_.IsRunning());
+
+ // ...it resets the timer if it's running so that the worker is kept
+ // alive for a while right after a new controlee is attached.
+ EXPECT_GE(delay, version_->stop_worker_timer_.GetCurrentDelay());
falken 2014/12/18 08:26:40 I don't quite get this, what does GetCurrentDelay(
kinuko 2014/12/18 08:31:40 Um, nvm, this line is not right (I wanted to compa
}
TEST_F(ServiceWorkerVersionTest, ListenerAvailability) {
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698