| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 EmbeddedWorkerTestHelper* helper_; | 62 EmbeddedWorkerTestHelper* helper_; |
| 63 ~TestingServiceWorkerDispatcherHost() override {} | 63 ~TestingServiceWorkerDispatcherHost() override {} |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 class ServiceWorkerDispatcherHostTest : public testing::Test { | 66 class ServiceWorkerDispatcherHostTest : public testing::Test { |
| 67 protected: | 67 protected: |
| 68 ServiceWorkerDispatcherHostTest() | 68 ServiceWorkerDispatcherHostTest() |
| 69 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} | 69 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 70 | 70 |
| 71 void SetUp() override { | 71 void SetUp() override { |
| 72 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); | 72 helper_.reset( |
| 73 new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId)); |
| 73 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( | 74 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( |
| 74 kRenderProcessId, context_wrapper(), &resource_context_, helper_.get()); | 75 kRenderProcessId, context_wrapper(), &resource_context_, helper_.get()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void TearDown() override { helper_.reset(); } | 78 void TearDown() override { helper_.reset(); } |
| 78 | 79 |
| 79 ServiceWorkerContextCore* context() { return helper_->context(); } | 80 ServiceWorkerContextCore* context() { return helper_->context(); } |
| 80 ServiceWorkerContextWrapper* context_wrapper() { | 81 ServiceWorkerContextWrapper* context_wrapper() { |
| 81 return helper_->context_wrapper(); | 82 return helper_->context_wrapper(); |
| 82 } | 83 } |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 // the old dispatcher cleaned up the old provider host, the new one won't | 565 // the old dispatcher cleaned up the old provider host, the new one won't |
| 565 // complain. | 566 // complain. |
| 566 new_dispatcher_host->OnMessageReceived( | 567 new_dispatcher_host->OnMessageReceived( |
| 567 ServiceWorkerHostMsg_ProviderCreated( | 568 ServiceWorkerHostMsg_ProviderCreated( |
| 568 kProviderId, MSG_ROUTING_NONE, | 569 kProviderId, MSG_ROUTING_NONE, |
| 569 SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE)); | 570 SERVICE_WORKER_PROVIDER_FOR_CONTROLLEE)); |
| 570 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); | 571 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); |
| 571 } | 572 } |
| 572 | 573 |
| 573 } // namespace content | 574 } // namespace content |
| OLD | NEW |