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 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/containers/scoped_ptr_hash_map.h" | 15 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "content/common/mojo/service_registry_impl.h" | 18 #include "content/common/mojo/service_registry_impl.h" |
19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
20 #include "ipc/ipc_test_sink.h" | 20 #include "ipc/ipc_test_sink.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 class GURL; | 24 class GURL; |
25 struct EmbeddedWorkerMsg_StartWorker_Params; | 25 struct EmbeddedWorkerMsg_StartWorker_Params; |
26 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; | 26 struct ServiceWorkerMsg_ExtendableMessageEvent_Params; |
27 | 27 |
| 28 namespace shell { |
| 29 class InterfaceRegistry; |
| 30 } |
| 31 |
28 namespace content { | 32 namespace content { |
29 | 33 |
30 class EmbeddedWorkerRegistry; | 34 class EmbeddedWorkerRegistry; |
31 class EmbeddedWorkerTestHelper; | 35 class EmbeddedWorkerTestHelper; |
32 class MessagePortMessageFilter; | 36 class MessagePortMessageFilter; |
33 class MockRenderProcessHost; | 37 class MockRenderProcessHost; |
34 class ServiceWorkerContextCore; | 38 class ServiceWorkerContextCore; |
35 class ServiceWorkerContextWrapper; | 39 class ServiceWorkerContextWrapper; |
36 class TestBrowserContext; | 40 class TestBrowserContext; |
37 struct PushEventPayload; | 41 struct PushEventPayload; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 std::unique_ptr<MockRenderProcessHost> render_process_host_; | 176 std::unique_ptr<MockRenderProcessHost> render_process_host_; |
173 | 177 |
174 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; | 178 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; |
175 | 179 |
176 IPC::TestSink sink_; | 180 IPC::TestSink sink_; |
177 IPC::TestSink inner_sink_; | 181 IPC::TestSink inner_sink_; |
178 | 182 |
179 int next_thread_id_; | 183 int next_thread_id_; |
180 int mock_render_process_id_; | 184 int mock_render_process_id_; |
181 | 185 |
182 ServiceRegistryImpl render_process_service_registry_; | 186 std::unique_ptr<shell::InterfaceRegistry> render_process_interface_registry_; |
183 | 187 |
184 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; | 188 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; |
185 | 189 |
186 // Stores the ServiceRegistries that are associated with each individual | 190 // Stores the ServiceRegistries that are associated with each individual |
187 // service worker. | 191 // service worker. |
188 base::ScopedPtrHashMap<int, std::unique_ptr<ServiceRegistryImpl>> | 192 base::ScopedPtrHashMap<int, std::unique_ptr<ServiceRegistryImpl>> |
189 thread_id_service_registry_map_; | 193 thread_id_service_registry_map_; |
190 | 194 |
191 // Updated each time MessageToWorker message is received. | 195 // Updated each time MessageToWorker message is received. |
192 int current_embedded_worker_id_; | 196 int current_embedded_worker_id_; |
193 | 197 |
194 std::vector<scoped_refptr<MessagePortMessageFilter>> | 198 std::vector<scoped_refptr<MessagePortMessageFilter>> |
195 message_port_message_filters_; | 199 message_port_message_filters_; |
196 | 200 |
197 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; | 201 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; |
198 | 202 |
199 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); | 203 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); |
200 }; | 204 }; |
201 | 205 |
202 } // namespace content | 206 } // namespace content |
203 | 207 |
204 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 208 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
OLD | NEW |