Chromium Code Reviews| 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 ServiceWorkerProviderInfoForStartWorker; | |
| 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( | |
|
falken
2017/06/19 07:50:40
BindWithProviderInfo
shimazu
2017/06/19 10:41:25
Done.
| |
| 67 mojom::ServiceWorkerProviderInfoForStartWorker* info); | |
| 61 | 68 |
| 62 mojom::ServiceWorkerProviderHostAssociatedPtr* host_ptr() { | 69 mojom::ServiceWorkerProviderHostAssociatedPtr* host_ptr() { |
| 63 return &host_ptr_; | 70 return &host_ptr_; |
| 64 } | 71 } |
| 65 | 72 |
| 66 mojom::ServiceWorkerProviderAssociatedRequest* client_request() { | 73 mojom::ServiceWorkerProviderAssociatedRequest* client_request() { |
| 67 return &client_request_; | 74 return &client_request_; |
| 68 } | 75 } |
| 69 | 76 |
| 70 private: | 77 private: |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 81 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( | 88 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
| 82 int process_id, | 89 int process_id, |
| 83 int provider_id, | 90 int provider_id, |
| 84 bool is_parent_frame_secure, | 91 bool is_parent_frame_secure, |
| 85 base::WeakPtr<ServiceWorkerContextCore> context, | 92 base::WeakPtr<ServiceWorkerContextCore> context, |
| 86 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 93 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
| 87 | 94 |
| 88 std::unique_ptr<ServiceWorkerProviderHost> | 95 std::unique_ptr<ServiceWorkerProviderHost> |
| 89 CreateProviderHostForServiceWorkerContext( | 96 CreateProviderHostForServiceWorkerContext( |
| 90 int process_id, | 97 int process_id, |
| 91 int provider_id, | |
| 92 bool is_parent_frame_secure, | 98 bool is_parent_frame_secure, |
| 99 ServiceWorkerVersion* hosted_version, | |
| 93 base::WeakPtr<ServiceWorkerContextCore> context, | 100 base::WeakPtr<ServiceWorkerContextCore> context, |
| 94 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 101 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
| 95 | 102 |
| 96 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( | 103 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( |
| 97 int process_id, | 104 int process_id, |
| 98 int provider_id, | 105 int provider_id, |
| 99 base::WeakPtr<ServiceWorkerContextCore> context, | 106 base::WeakPtr<ServiceWorkerContextCore> context, |
| 100 int route_id, | 107 int route_id, |
| 101 ServiceWorkerDispatcherHost* dispatcher_host, | 108 ServiceWorkerDispatcherHost* dispatcher_host, |
| 102 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | 109 ServiceWorkerRemoteProviderEndpoint* output_endpoint); |
| 103 | 110 |
| 104 } // namespace content | 111 } // namespace content |
| 105 | 112 |
| 106 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 113 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
| OLD | NEW |