| 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 19 matching lines...) Expand all Loading... |
| 30 class GURL; | 30 class GURL; |
| 31 | 31 |
| 32 namespace service_manager { | 32 namespace service_manager { |
| 33 class InterfaceRegistry; | 33 class InterfaceRegistry; |
| 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; | |
| 41 class MockRenderProcessHost; | 40 class MockRenderProcessHost; |
| 42 class ServiceWorkerContextCore; | 41 class ServiceWorkerContextCore; |
| 43 class ServiceWorkerContextWrapper; | 42 class ServiceWorkerContextWrapper; |
| 44 class TestBrowserContext; | 43 class TestBrowserContext; |
| 45 struct EmbeddedWorkerStartParams; | 44 struct EmbeddedWorkerStartParams; |
| 46 struct PushEventPayload; | 45 struct PushEventPayload; |
| 47 struct ServiceWorkerFetchRequest; | 46 struct ServiceWorkerFetchRequest; |
| 48 | 47 |
| 49 // In-Process EmbeddedWorker test helper. | 48 // In-Process EmbeddedWorker test helper. |
| 50 // | 49 // |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 const FetchCallback& callback); | 238 const FetchCallback& callback); |
| 240 void OnPushEventStub( | 239 void OnPushEventStub( |
| 241 const PushEventPayload& payload, | 240 const PushEventPayload& payload, |
| 242 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& | 241 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& |
| 243 callback); | 242 callback); |
| 244 void OnPaymentRequestEventStub( | 243 void OnPaymentRequestEventStub( |
| 245 payments::mojom::PaymentAppRequestPtr data, | 244 payments::mojom::PaymentAppRequestPtr data, |
| 246 const mojom::ServiceWorkerEventDispatcher:: | 245 const mojom::ServiceWorkerEventDispatcher:: |
| 247 DispatchPaymentRequestEventCallback& callback); | 246 DispatchPaymentRequestEventCallback& callback); |
| 248 | 247 |
| 249 MessagePortMessageFilter* NewMessagePortMessageFilter(); | |
| 250 | |
| 251 std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry( | 248 std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry( |
| 252 MockRenderProcessHost* rph); | 249 MockRenderProcessHost* rph); |
| 253 | 250 |
| 254 std::unique_ptr<TestBrowserContext> browser_context_; | 251 std::unique_ptr<TestBrowserContext> browser_context_; |
| 255 std::unique_ptr<MockRenderProcessHost> render_process_host_; | 252 std::unique_ptr<MockRenderProcessHost> render_process_host_; |
| 256 std::unique_ptr<MockRenderProcessHost> new_render_process_host_; | 253 std::unique_ptr<MockRenderProcessHost> new_render_process_host_; |
| 257 | 254 |
| 258 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; | 255 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; |
| 259 | 256 |
| 260 IPC::TestSink sink_; | 257 IPC::TestSink sink_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 273 std::unique_ptr<service_manager::InterfaceRegistry> | 270 std::unique_ptr<service_manager::InterfaceRegistry> |
| 274 new_render_process_interface_registry_; | 271 new_render_process_interface_registry_; |
| 275 | 272 |
| 276 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; | 273 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; |
| 277 std::map<int /* thread_id */, int /* embedded_worker_id */> | 274 std::map<int /* thread_id */, int /* embedded_worker_id */> |
| 278 thread_id_embedded_worker_id_map_; | 275 thread_id_embedded_worker_id_map_; |
| 279 | 276 |
| 280 // Updated each time MessageToWorker message is received. | 277 // Updated each time MessageToWorker message is received. |
| 281 int current_embedded_worker_id_; | 278 int current_embedded_worker_id_; |
| 282 | 279 |
| 283 std::vector<scoped_refptr<MessagePortMessageFilter>> | |
| 284 message_port_message_filters_; | |
| 285 | |
| 286 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; | 280 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; |
| 287 | 281 |
| 288 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); | 282 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); |
| 289 }; | 283 }; |
| 290 | 284 |
| 291 template <typename MockType, typename... Args> | 285 template <typename MockType, typename... Args> |
| 292 MockType* EmbeddedWorkerTestHelper::CreateAndRegisterMockInstanceClient( | 286 MockType* EmbeddedWorkerTestHelper::CreateAndRegisterMockInstanceClient( |
| 293 Args&&... args) { | 287 Args&&... args) { |
| 294 std::unique_ptr<MockType> mock = | 288 std::unique_ptr<MockType> mock = |
| 295 base::MakeUnique<MockType>(std::forward<Args>(args)...); | 289 base::MakeUnique<MockType>(std::forward<Args>(args)...); |
| 296 MockType* mock_rawptr = mock.get(); | 290 MockType* mock_rawptr = mock.get(); |
| 297 RegisterMockInstanceClient(std::move(mock)); | 291 RegisterMockInstanceClient(std::move(mock)); |
| 298 return mock_rawptr; | 292 return mock_rawptr; |
| 299 } | 293 } |
| 300 | 294 |
| 301 } // namespace content | 295 } // namespace content |
| 302 | 296 |
| 303 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 297 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
| OLD | NEW |