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" |
11 #include "content/browser/service_worker/embedded_worker_instance.h" | 11 #include "content/browser/service_worker/embedded_worker_instance.h" |
12 #include "content/browser/service_worker/embedded_worker_registry.h" | 12 #include "content/browser/service_worker/embedded_worker_registry.h" |
13 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 13 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
14 #include "content/browser/service_worker/service_worker_context_core.h" | 14 #include "content/browser/service_worker/service_worker_context_core.h" |
15 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 15 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
16 #include "content/common/service_worker/embedded_worker_messages.h" | 16 #include "content/common/service_worker/embedded_worker_messages.h" |
17 #include "content/common/service_worker/service_worker_messages.h" | 17 #include "content/common/service_worker/service_worker_messages.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
| 22 namespace webkit_blob { |
| 23 class BlobStorageContext; |
| 24 } |
| 25 |
22 namespace content { | 26 namespace content { |
23 | 27 |
24 static const int kRenderProcessId = 1; | 28 static const int kRenderProcessId = 1; |
25 | 29 |
26 class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { | 30 class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost { |
27 public: | 31 public: |
28 TestingServiceWorkerDispatcherHost( | 32 TestingServiceWorkerDispatcherHost( |
29 int process_id, | 33 int process_id, |
30 ServiceWorkerContextWrapper* context_wrapper, | 34 ServiceWorkerContextWrapper* context_wrapper, |
31 EmbeddedWorkerTestHelper* helper) | 35 EmbeddedWorkerTestHelper* helper) |
32 : ServiceWorkerDispatcherHost(process_id, NULL), | 36 : ServiceWorkerDispatcherHost(process_id, NULL), |
33 bad_messages_received_count_(0), | 37 bad_messages_received_count_(0), |
34 helper_(helper) { | 38 helper_(helper) { |
35 Init(context_wrapper); | 39 Init(context_wrapper, NULL, NULL); |
36 } | 40 } |
37 | 41 |
38 virtual bool Send(IPC::Message* message) OVERRIDE { | 42 virtual bool Send(IPC::Message* message) OVERRIDE { |
39 return helper_->Send(message); | 43 return helper_->Send(message); |
40 } | 44 } |
41 | 45 |
42 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } | 46 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } |
43 | 47 |
44 virtual void BadMessageReceived() OVERRIDE { | 48 virtual void BadMessageReceived() OVERRIDE { |
45 ++bad_messages_received_count_; | 49 ++bad_messages_received_count_; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // process to get deleted as well. | 233 // process to get deleted as well. |
230 dispatcher_host_->OnMessageReceived( | 234 dispatcher_host_->OnMessageReceived( |
231 ServiceWorkerHostMsg_ProviderCreated(kProviderId)); | 235 ServiceWorkerHostMsg_ProviderCreated(kProviderId)); |
232 EXPECT_TRUE(context()->GetProviderHost(kRenderProcessId, kProviderId)); | 236 EXPECT_TRUE(context()->GetProviderHost(kRenderProcessId, kProviderId)); |
233 EXPECT_TRUE(dispatcher_host_->HasOneRef()); | 237 EXPECT_TRUE(dispatcher_host_->HasOneRef()); |
234 dispatcher_host_ = NULL; | 238 dispatcher_host_ = NULL; |
235 EXPECT_FALSE(context()->GetProviderHost(kRenderProcessId, kProviderId)); | 239 EXPECT_FALSE(context()->GetProviderHost(kRenderProcessId, kProviderId)); |
236 } | 240 } |
237 | 241 |
238 } // namespace content | 242 } // namespace content |
OLD | NEW |