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_interfaces.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 namespace mojom { |
| 22 class ServiceWorkerProviderClientInfo; |
| 23 } // namespace mojom |
| 24 |
21 class ServiceWorkerContextCore; | 25 class ServiceWorkerContextCore; |
22 class ServiceWorkerDispatcherHost; | 26 class ServiceWorkerDispatcherHost; |
23 class ServiceWorkerProviderHost; | 27 class ServiceWorkerProviderHost; |
| 28 class ServiceWorkerVersion; |
24 struct ServiceWorkerProviderHostInfo; | 29 struct ServiceWorkerProviderHostInfo; |
25 | 30 |
26 template <typename Arg> | 31 template <typename Arg> |
27 void ReceiveResult(BrowserThread::ID run_quit_thread, | 32 void ReceiveResult(BrowserThread::ID run_quit_thread, |
28 const base::Closure& quit, | 33 const base::Closure& quit, |
29 Arg* out, Arg actual) { | 34 Arg* out, Arg actual) { |
30 *out = actual; | 35 *out = actual; |
31 if (!quit.is_null()) | 36 if (!quit.is_null()) |
32 BrowserThread::PostTask(run_quit_thread, FROM_HERE, quit); | 37 BrowserThread::PostTask(run_quit_thread, FROM_HERE, quit); |
33 } | 38 } |
(...skipping 17 matching lines...) Expand all Loading... |
51 // Container for keeping the Mojo connection to the service worker provider on | 56 // Container for keeping the Mojo connection to the service worker provider on |
52 // the renderer alive. | 57 // the renderer alive. |
53 class ServiceWorkerRemoteProviderEndpoint { | 58 class ServiceWorkerRemoteProviderEndpoint { |
54 public: | 59 public: |
55 ServiceWorkerRemoteProviderEndpoint(); | 60 ServiceWorkerRemoteProviderEndpoint(); |
56 ServiceWorkerRemoteProviderEndpoint( | 61 ServiceWorkerRemoteProviderEndpoint( |
57 ServiceWorkerRemoteProviderEndpoint&& other); | 62 ServiceWorkerRemoteProviderEndpoint&& other); |
58 ~ServiceWorkerRemoteProviderEndpoint(); | 63 ~ServiceWorkerRemoteProviderEndpoint(); |
59 | 64 |
60 void BindWithProviderHostInfo(ServiceWorkerProviderHostInfo* info); | 65 void BindWithProviderHostInfo(ServiceWorkerProviderHostInfo* info); |
| 66 void BindWithProviderClientInfo(mojom::ServiceWorkerProviderClientInfo* info); |
61 | 67 |
62 mojom::ServiceWorkerProviderHostAssociatedPtr* host_ptr() { | 68 mojom::ServiceWorkerProviderHostAssociatedPtr* host_ptr() { |
63 return &host_ptr_; | 69 return &host_ptr_; |
64 } | 70 } |
65 | 71 |
66 mojom::ServiceWorkerProviderAssociatedRequest* client_request() { | 72 mojom::ServiceWorkerProviderAssociatedRequest* client_request() { |
67 return &client_request_; | 73 return &client_request_; |
68 } | 74 } |
69 | 75 |
70 private: | 76 private: |
(...skipping 10 matching lines...) Expand all Loading... |
81 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( | 87 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
82 int process_id, | 88 int process_id, |
83 int provider_id, | 89 int provider_id, |
84 bool is_parent_frame_secure, | 90 bool is_parent_frame_secure, |
85 base::WeakPtr<ServiceWorkerContextCore> context, | 91 base::WeakPtr<ServiceWorkerContextCore> context, |
86 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 92 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
87 | 93 |
88 std::unique_ptr<ServiceWorkerProviderHost> | 94 std::unique_ptr<ServiceWorkerProviderHost> |
89 CreateProviderHostForServiceWorkerContext( | 95 CreateProviderHostForServiceWorkerContext( |
90 int process_id, | 96 int process_id, |
91 int provider_id, | |
92 bool is_parent_frame_secure, | 97 bool is_parent_frame_secure, |
| 98 ServiceWorkerVersion* hosted_version, |
93 base::WeakPtr<ServiceWorkerContextCore> context, | 99 base::WeakPtr<ServiceWorkerContextCore> context, |
94 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 100 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
95 | 101 |
96 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( | 102 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( |
97 int process_id, | 103 int process_id, |
98 int provider_id, | 104 int provider_id, |
99 base::WeakPtr<ServiceWorkerContextCore> context, | 105 base::WeakPtr<ServiceWorkerContextCore> context, |
100 int route_id, | 106 int route_id, |
101 ServiceWorkerDispatcherHost* dispatcher_host, | 107 ServiceWorkerDispatcherHost* dispatcher_host, |
102 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 108 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
103 | 109 |
104 } // namespace content | 110 } // namespace content |
105 | 111 |
106 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 112 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
OLD | NEW |