| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 protected: | 49 protected: |
| 50 EmbeddedWorkerTestHelper* helper_; | 50 EmbeddedWorkerTestHelper* helper_; |
| 51 ~TestingServiceWorkerDispatcherHost() override {} | 51 ~TestingServiceWorkerDispatcherHost() override {} |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class ServiceWorkerDispatcherHostTest : public testing::Test { | 54 class ServiceWorkerDispatcherHostTest : public testing::Test { |
| 55 protected: | 55 protected: |
| 56 ServiceWorkerDispatcherHostTest() | 56 ServiceWorkerDispatcherHostTest() |
| 57 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 57 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 58 | 58 |
| 59 virtual void SetUp() { | 59 void SetUp() override { |
| 60 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); | 60 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); |
| 61 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( | 61 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( |
| 62 kRenderProcessId, context_wrapper(), &resource_context_, helper_.get()); | 62 kRenderProcessId, context_wrapper(), &resource_context_, helper_.get()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void TearDown() { | 65 void TearDown() override { helper_.reset(); } |
| 66 helper_.reset(); | |
| 67 } | |
| 68 | 66 |
| 69 ServiceWorkerContextCore* context() { return helper_->context(); } | 67 ServiceWorkerContextCore* context() { return helper_->context(); } |
| 70 ServiceWorkerContextWrapper* context_wrapper() { | 68 ServiceWorkerContextWrapper* context_wrapper() { |
| 71 return helper_->context_wrapper(); | 69 return helper_->context_wrapper(); |
| 72 } | 70 } |
| 73 | 71 |
| 74 void SendRegister(int64 provider_id, GURL pattern, GURL worker_url) { | 72 void SendRegister(int64 provider_id, GURL pattern, GURL worker_url) { |
| 75 dispatcher_host_->OnMessageReceived( | 73 dispatcher_host_->OnMessageReceived( |
| 76 ServiceWorkerHostMsg_RegisterServiceWorker( | 74 ServiceWorkerHostMsg_RegisterServiceWorker( |
| 77 -1, -1, provider_id, pattern, worker_url)); | 75 -1, -1, provider_id, pattern, worker_url)); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 371 |
| 374 // Let the shutdown reach the simulated IO thread. | 372 // Let the shutdown reach the simulated IO thread. |
| 375 base::RunLoop().RunUntilIdle(); | 373 base::RunLoop().RunUntilIdle(); |
| 376 | 374 |
| 377 GetRegistration(-1, | 375 GetRegistration(-1, |
| 378 GURL(), | 376 GURL(), |
| 379 ServiceWorkerMsg_ServiceWorkerGetRegistrationError::ID); | 377 ServiceWorkerMsg_ServiceWorkerGetRegistrationError::ID); |
| 380 } | 378 } |
| 381 | 379 |
| 382 } // namespace content | 380 } // namespace content |
| OLD | NEW |