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/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 | 20 |
| 20 class ServiceWorkerContextCore; | 21 class ServiceWorkerContextCore; |
| 21 class ServiceWorkerDispatcherHost; | 22 class ServiceWorkerDispatcherHost; |
| 22 class ServiceWorkerProviderHost; | 23 class ServiceWorkerProviderHost; |
| 23 | 24 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 38 | 39 |
| 39 template <typename Arg> | 40 template <typename Arg> |
| 40 base::Callback<void(Arg)> CreateReceiverOnCurrentThread( | 41 base::Callback<void(Arg)> CreateReceiverOnCurrentThread( |
| 41 Arg* out, | 42 Arg* out, |
| 42 const base::Closure& quit = base::Closure()) { | 43 const base::Closure& quit = base::Closure()) { |
| 43 BrowserThread::ID id; | 44 BrowserThread::ID id; |
| 44 bool ret = BrowserThread::GetCurrentThreadIdentifier(&id); | 45 bool ret = BrowserThread::GetCurrentThreadIdentifier(&id); |
| 45 DCHECK(ret); | 46 DCHECK(ret); |
| 46 return base::Bind(&ReceiveResult<Arg>, id, quit, out); | 47 return base::Bind(&ReceiveResult<Arg>, id, quit, out); |
| 47 } | 48 } |
| 48 | 49 |
|
falken
2017/05/18 04:13:09
please add a class level comment
shimazu
2017/05/19 08:31:06
Done.
| |
| 50 class ServiceWorkerRemoteProviderEndpoint { | |
|
falken
2017/05/18 04:13:09
seems this should be a struct?
shimazu
2017/05/19 08:31:06
Done.
| |
| 51 public: | |
| 52 ServiceWorkerRemoteProviderEndpoint(); | |
| 53 ServiceWorkerRemoteProviderEndpoint( | |
| 54 ServiceWorkerRemoteProviderEndpoint&& other); | |
| 55 ~ServiceWorkerRemoteProviderEndpoint(); | |
| 56 | |
| 57 mojom::ServiceWorkerProviderHostAssociatedPtr host_ptr; | |
| 58 mojom::ServiceWorkerProviderAssociatedRequest client_request; | |
|
falken
2017/05/18 04:13:09
Can you comment what these two members do?
shimazu
2017/05/19 08:31:06
Done.
| |
| 59 | |
| 60 private: | |
| 61 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRemoteProviderEndpoint); | |
| 62 }; | |
| 63 | |
| 49 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( | 64 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
| 50 int process_id, | 65 int process_id, |
| 51 int provider_id, | 66 int provider_id, |
| 52 bool is_parent_frame_secure, | 67 bool is_parent_frame_secure, |
| 53 base::WeakPtr<ServiceWorkerContextCore> context); | 68 base::WeakPtr<ServiceWorkerContextCore> context, |
| 69 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | |
| 54 | 70 |
| 55 std::unique_ptr<ServiceWorkerProviderHost> | 71 std::unique_ptr<ServiceWorkerProviderHost> |
| 56 CreateProviderHostForServiceWorkerContext( | 72 CreateProviderHostForServiceWorkerContext( |
| 57 int process_id, | 73 int process_id, |
| 58 int provider_id, | 74 int provider_id, |
| 59 bool is_parent_frame_secure, | 75 bool is_parent_frame_secure, |
| 60 base::WeakPtr<ServiceWorkerContextCore> context); | 76 base::WeakPtr<ServiceWorkerContextCore> context, |
| 77 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | |
| 61 | 78 |
| 62 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( | 79 std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( |
| 63 int process_id, | 80 int process_id, |
| 64 int provider_id, | 81 int provider_id, |
| 65 base::WeakPtr<ServiceWorkerContextCore> context, | 82 base::WeakPtr<ServiceWorkerContextCore> context, |
| 66 int route_id, | 83 int route_id, |
| 67 ServiceWorkerDispatcherHost* dispatcher_host); | 84 ServiceWorkerDispatcherHost* dispatcher_host, |
| 85 ServiceWorkerRemoteProviderEndpoint* output_endpoint); | |
| 68 | 86 |
| 69 } // namespace content | 87 } // namespace content |
| 70 | 88 |
| 71 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ | 89 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_TEST_UTILS_H_ |
| OLD | NEW |