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