| 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/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
| 9 #include "content/browser/service_worker/embedded_worker_registry.h" | 9 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 10 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 388 |
| 389 ASSERT_FALSE(called); | 389 ASSERT_FALSE(called); |
| 390 base::RunLoop().RunUntilIdle(); | 390 base::RunLoop().RunUntilIdle(); |
| 391 ASSERT_TRUE(called); | 391 ASSERT_TRUE(called); |
| 392 | 392 |
| 393 ASSERT_EQ(new_registration, old_registration); | 393 ASSERT_EQ(new_registration, old_registration); |
| 394 } | 394 } |
| 395 | 395 |
| 396 class FailToStartWorkerTestHelper : public EmbeddedWorkerTestHelper { | 396 class FailToStartWorkerTestHelper : public EmbeddedWorkerTestHelper { |
| 397 public: | 397 public: |
| 398 FailToStartWorkerTestHelper(int mock_render_process_id) | 398 explicit FailToStartWorkerTestHelper(int mock_render_process_id) |
| 399 : EmbeddedWorkerTestHelper(mock_render_process_id) {} | 399 : EmbeddedWorkerTestHelper(mock_render_process_id) {} |
| 400 | 400 |
| 401 virtual void OnStartWorker(int embedded_worker_id, | 401 virtual void OnStartWorker(int embedded_worker_id, |
| 402 int64 service_worker_version_id, | 402 int64 service_worker_version_id, |
| 403 const GURL& scope, | 403 const GURL& scope, |
| 404 const GURL& script_url) OVERRIDE { | 404 const GURL& script_url) OVERRIDE { |
| 405 // Simulate failure by sending worker stopped instead of started. | 405 // Simulate failure by sending worker stopped instead of started. |
| 406 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 406 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
| 407 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); | 407 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); |
| 408 } | 408 } |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 | 809 |
| 810 registration->active_version()->RemoveControllee(host.get()); | 810 registration->active_version()->RemoveControllee(host.get()); |
| 811 base::RunLoop().RunUntilIdle(); | 811 base::RunLoop().RunUntilIdle(); |
| 812 | 812 |
| 813 // The version should be stopped since there is no controllee. | 813 // The version should be stopped since there is no controllee. |
| 814 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version->running_status()); | 814 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version->running_status()); |
| 815 EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, version->status()); | 815 EXPECT_EQ(ServiceWorkerVersion::REDUNDANT, version->status()); |
| 816 } | 816 } |
| 817 | 817 |
| 818 } // namespace content | 818 } // namespace content |
| OLD | NEW |