| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |