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_SERVICE_WORKER_TEST_UTILS_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/common/service_worker/service_worker_provider.mojom.h" | 14 #include "content/common/service_worker/service_worker_provider_interfaces.mojom
.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class ServiceWorkerContextCore; | 21 class ServiceWorkerContextCore; |
22 class ServiceWorkerDispatcherHost; | 22 class ServiceWorkerDispatcherHost; |
23 class ServiceWorkerProviderHost; | 23 class ServiceWorkerProviderHost; |
24 class ServiceWorkerVersion; | |
25 struct ServiceWorkerProviderHostInfo; | 24 struct ServiceWorkerProviderHostInfo; |
26 | 25 |
27 template <typename Arg> | 26 template <typename Arg> |
28 void ReceiveResult(BrowserThread::ID run_quit_thread, | 27 void ReceiveResult(BrowserThread::ID run_quit_thread, |
29 const base::Closure& quit, | 28 const base::Closure& quit, |
30 Arg* out, Arg actual) { | 29 Arg* out, Arg actual) { |
31 *out = actual; | 30 *out = actual; |
32 if (!quit.is_null()) | 31 if (!quit.is_null()) |
33 BrowserThread::PostTask(run_quit_thread, FROM_HERE, quit); | 32 BrowserThread::PostTask(run_quit_thread, FROM_HERE, quit); |
34 } | 33 } |
(...skipping 17 matching lines...) Expand all Loading... |
52 // Container for keeping the Mojo connection to the service worker provider on | 51 // Container for keeping the Mojo connection to the service worker provider on |
53 // the renderer alive. | 52 // the renderer alive. |
54 class ServiceWorkerRemoteProviderEndpoint { | 53 class ServiceWorkerRemoteProviderEndpoint { |
55 public: | 54 public: |
56 ServiceWorkerRemoteProviderEndpoint(); | 55 ServiceWorkerRemoteProviderEndpoint(); |
57 ServiceWorkerRemoteProviderEndpoint( | 56 ServiceWorkerRemoteProviderEndpoint( |
58 ServiceWorkerRemoteProviderEndpoint&& other); | 57 ServiceWorkerRemoteProviderEndpoint&& other); |
59 ~ServiceWorkerRemoteProviderEndpoint(); | 58 ~ServiceWorkerRemoteProviderEndpoint(); |
60 | 59 |
61 void BindWithProviderHostInfo(ServiceWorkerProviderHostInfo* info); | 60 void BindWithProviderHostInfo(ServiceWorkerProviderHostInfo* info); |
62 void BindWithProviderInfo( | |
63 mojom::ServiceWorkerProviderInfoForStartWorkerPtr info); | |
64 | 61 |
65 mojom::ServiceWorkerProviderHostAssociatedPtr* host_ptr() { | 62 mojom::ServiceWorkerProviderHostAssociatedPtr* host_ptr() { |
66 return &host_ptr_; | 63 return &host_ptr_; |
67 } | 64 } |
68 | 65 |
69 mojom::ServiceWorkerProviderAssociatedRequest* client_request() { | 66 mojom::ServiceWorkerProviderAssociatedRequest* client_request() { |
70 return &client_request_; | 67 return &client_request_; |
71 } | 68 } |
72 | 69 |
73 private: | 70 private: |
(...skipping 10 matching lines...) Expand all Loading... |
84 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( | 81 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
85 int process_id, | 82 int process_id, |
86 int provider_id, | 83 int provider_id, |
87 bool is_parent_frame_secure, | 84 bool is_parent_frame_secure, |
88 base::WeakPtr<ServiceWorkerContextCore> context, | 85 base::WeakPtr<ServiceWorkerContextCore> context, |
89 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 86 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
90 | 87 |
91 std::unique_ptr<ServiceWorkerProviderHost> | 88 std::unique_ptr<ServiceWorkerProviderHost> |
92 CreateProviderHostForServiceWorkerContext( | 89 CreateProviderHostForServiceWorkerContext( |
93 int process_id, | 90 int process_id, |
| 91 int provider_id, |
94 bool is_parent_frame_secure, | 92 bool is_parent_frame_secure, |
95 ServiceWorkerVersion* hosted_version, | |
96 base::WeakPtr<ServiceWorkerContextCore> context, | 93 base::WeakPtr<ServiceWorkerContextCore> context, |
97 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 94 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
98 | 95 |
99 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( | 96 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( |
100 int process_id, | 97 int process_id, |
101 int provider_id, | 98 int provider_id, |
102 base::WeakPtr<ServiceWorkerContextCore> context, | 99 base::WeakPtr<ServiceWorkerContextCore> context, |
103 int route_id, | 100 int route_id, |
104 ServiceWorkerDispatcherHost* dispatcher_host, | 101 ServiceWorkerDispatcherHost* dispatcher_host, |
105 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 102 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
106 | 103 |
107 } // namespace content | 104 } // namespace content |
108 | 105 |
109 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 106 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
OLD | NEW |