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> |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 namespace content { | 36 namespace content { |
37 | 37 |
38 class EmbeddedWorkerRegistry; | 38 class EmbeddedWorkerRegistry; |
39 class EmbeddedWorkerTestHelper; | 39 class EmbeddedWorkerTestHelper; |
40 class MessagePortMessageFilter; | 40 class MessagePortMessageFilter; |
41 class MockRenderProcessHost; | 41 class MockRenderProcessHost; |
42 class ServiceWorkerContextCore; | 42 class ServiceWorkerContextCore; |
43 class ServiceWorkerContextWrapper; | 43 class ServiceWorkerContextWrapper; |
| 44 class ServiceWorkerDispatcherHost; |
44 class TestBrowserContext; | 45 class TestBrowserContext; |
45 struct EmbeddedWorkerStartParams; | 46 struct EmbeddedWorkerStartParams; |
46 struct PushEventPayload; | 47 struct PushEventPayload; |
47 struct ServiceWorkerFetchRequest; | 48 struct ServiceWorkerFetchRequest; |
48 | 49 |
49 // In-Process EmbeddedWorker test helper. | 50 // In-Process EmbeddedWorker test helper. |
50 // | 51 // |
51 // Usage: create an instance of this class to test browser-side embedded worker | 52 // Usage: create an instance of this class to test browser-side embedded worker |
52 // code without creating a child process. This class will create a | 53 // code without creating a child process. This class will create a |
53 // ServiceWorkerContextWrapper and ServiceWorkerContextCore for you. | 54 // ServiceWorkerContextWrapper and ServiceWorkerContextCore for you. |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 IPC::TestSink inner_sink_; | 262 IPC::TestSink inner_sink_; |
262 | 263 |
263 std::vector<std::unique_ptr<MockEmbeddedWorkerInstanceClient>> | 264 std::vector<std::unique_ptr<MockEmbeddedWorkerInstanceClient>> |
264 mock_instance_clients_; | 265 mock_instance_clients_; |
265 size_t mock_instance_clients_next_index_; | 266 size_t mock_instance_clients_next_index_; |
266 | 267 |
267 int next_thread_id_; | 268 int next_thread_id_; |
268 int mock_render_process_id_; | 269 int mock_render_process_id_; |
269 int new_mock_render_process_id_; | 270 int new_mock_render_process_id_; |
270 | 271 |
| 272 std::map<int /* process_id */, scoped_refptr<ServiceWorkerDispatcherHost>> |
| 273 dispatcher_hosts_; |
| 274 |
271 std::unique_ptr<service_manager::InterfaceRegistry> | 275 std::unique_ptr<service_manager::InterfaceRegistry> |
272 render_process_interface_registry_; | 276 render_process_interface_registry_; |
273 std::unique_ptr<service_manager::InterfaceRegistry> | 277 std::unique_ptr<service_manager::InterfaceRegistry> |
274 new_render_process_interface_registry_; | 278 new_render_process_interface_registry_; |
275 | 279 |
276 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; | 280 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; |
277 std::map<int /* thread_id */, int /* embedded_worker_id */> | 281 std::map<int /* thread_id */, int /* embedded_worker_id */> |
278 thread_id_embedded_worker_id_map_; | 282 thread_id_embedded_worker_id_map_; |
279 | 283 |
280 // Updated each time MessageToWorker message is received. | 284 // Updated each time MessageToWorker message is received. |
(...skipping 13 matching lines...) Expand all Loading... |
294 std::unique_ptr<MockType> mock = | 298 std::unique_ptr<MockType> mock = |
295 base::MakeUnique<MockType>(std::forward<Args>(args)...); | 299 base::MakeUnique<MockType>(std::forward<Args>(args)...); |
296 MockType* mock_rawptr = mock.get(); | 300 MockType* mock_rawptr = mock.get(); |
297 RegisterMockInstanceClient(std::move(mock)); | 301 RegisterMockInstanceClient(std::move(mock)); |
298 return mock_rawptr; | 302 return mock_rawptr; |
299 } | 303 } |
300 | 304 |
301 } // namespace content | 305 } // namespace content |
302 | 306 |
303 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 307 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
OLD | NEW |