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

Side by Side Diff: content/browser/service_worker/service_worker_version_unittest.cc

Issue 991743002: Service Worker: Coalesce the start worker timer into the timeout timer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments 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 unified diff | Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/service_worker/embedded_worker_registry.h" 7 #include "content/browser/service_worker/embedded_worker_registry.h"
8 #include "content/browser/service_worker/embedded_worker_test_helper.h" 8 #include "content/browser/service_worker/embedded_worker_test_helper.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // starting the worker as part of dispatching an event. 457 // starting the worker as part of dispatching an event.
458 version_->SetStatus(ServiceWorkerVersion::ACTIVATING); 458 version_->SetStatus(ServiceWorkerVersion::ACTIVATING);
459 version_->DispatchActivateEvent(CreateReceiverOnCurrentThread(&status)); 459 version_->DispatchActivateEvent(CreateReceiverOnCurrentThread(&status));
460 base::RunLoop().RunUntilIdle(); 460 base::RunLoop().RunUntilIdle();
461 461
462 // Callback has not completed yet. 462 // Callback has not completed yet.
463 EXPECT_EQ(SERVICE_WORKER_ERROR_NETWORK, status); 463 EXPECT_EQ(SERVICE_WORKER_ERROR_NETWORK, status);
464 EXPECT_EQ(ServiceWorkerVersion::STARTING, version_->running_status()); 464 EXPECT_EQ(ServiceWorkerVersion::STARTING, version_->running_status());
465 465
466 // Simulate timeout. 466 // Simulate timeout.
467 EXPECT_TRUE(version_->start_worker_timeout_timer_.IsRunning()); 467 EXPECT_TRUE(version_->timeout_timer_.IsRunning());
468 version_->start_worker_timeout_timer_.user_task().Run(); 468 version_->start_time_ =
469 base::TimeTicks::Now() -
470 base::TimeDelta::FromMinutes(
471 ServiceWorkerVersion::kStartWorkerTimeoutMinutes + 1);
472 version_->timeout_timer_.user_task().Run();
469 base::RunLoop().RunUntilIdle(); 473 base::RunLoop().RunUntilIdle();
470 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status); 474 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status);
471 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status()); 475 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status());
472 } 476 }
473 477
474 } // namespace content 478 } // namespace content
OLDNEW
« 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