| 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/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/optional.h" | 19 #include "base/optional.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "content/browser/service_worker/service_worker_test_utils.h" |
| 21 #include "content/common/service_worker/embedded_worker.mojom.h" | 22 #include "content/common/service_worker/embedded_worker.mojom.h" |
| 22 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" | 23 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h" |
| 23 #include "content/common/service_worker/service_worker_status_code.h" | 24 #include "content/common/service_worker/service_worker_status_code.h" |
| 24 #include "ipc/ipc_listener.h" | 25 #include "ipc/ipc_listener.h" |
| 25 #include "ipc/ipc_test_sink.h" | 26 #include "ipc/ipc_test_sink.h" |
| 26 #include "mojo/public/cpp/bindings/binding.h" | 27 #include "mojo/public/cpp/bindings/binding.h" |
| 27 #include "net/http/http_response_info.h" | 28 #include "net/http/http_response_info.h" |
| 28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 29 | 30 |
| 30 class GURL; | 31 class GURL; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 dispatcher_hosts_; | 342 dispatcher_hosts_; |
| 342 | 343 |
| 343 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; | 344 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; |
| 344 std::map<int /* thread_id */, int /* embedded_worker_id */> | 345 std::map<int /* thread_id */, int /* embedded_worker_id */> |
| 345 thread_id_embedded_worker_id_map_; | 346 thread_id_embedded_worker_id_map_; |
| 346 | 347 |
| 347 std::map< | 348 std::map< |
| 348 int /* embedded_worker_id */, | 349 int /* embedded_worker_id */, |
| 349 mojom::EmbeddedWorkerInstanceHostAssociatedPtr /* instance_host_ptr */> | 350 mojom::EmbeddedWorkerInstanceHostAssociatedPtr /* instance_host_ptr */> |
| 350 embedded_worker_id_instance_host_ptr_map_; | 351 embedded_worker_id_instance_host_ptr_map_; |
| 352 std::map<int /* embedded_worker_id */, ServiceWorkerRemoteProviderEndpoint> |
| 353 embedded_worker_id_remote_provider_map_; |
| 351 | 354 |
| 352 std::vector<Event> events_; | 355 std::vector<Event> events_; |
| 353 | 356 |
| 354 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; | 357 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; |
| 355 | 358 |
| 356 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); | 359 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); |
| 357 }; | 360 }; |
| 358 | 361 |
| 359 template <typename MockType, typename... Args> | 362 template <typename MockType, typename... Args> |
| 360 MockType* EmbeddedWorkerTestHelper::CreateAndRegisterMockInstanceClient( | 363 MockType* EmbeddedWorkerTestHelper::CreateAndRegisterMockInstanceClient( |
| 361 Args&&... args) { | 364 Args&&... args) { |
| 362 std::unique_ptr<MockType> mock = | 365 std::unique_ptr<MockType> mock = |
| 363 base::MakeUnique<MockType>(std::forward<Args>(args)...); | 366 base::MakeUnique<MockType>(std::forward<Args>(args)...); |
| 364 MockType* mock_rawptr = mock.get(); | 367 MockType* mock_rawptr = mock.get(); |
| 365 RegisterMockInstanceClient(std::move(mock)); | 368 RegisterMockInstanceClient(std::move(mock)); |
| 366 return mock_rawptr; | 369 return mock_rawptr; |
| 367 } | 370 } |
| 368 | 371 |
| 369 } // namespace content | 372 } // namespace content |
| 370 | 373 |
| 371 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 374 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
| OLD | NEW |