Index: content/browser/service_worker/service_worker_test_utils.cc |
diff --git a/content/browser/service_worker/service_worker_test_utils.cc b/content/browser/service_worker/service_worker_test_utils.cc |
index 4c8f7390b91924cba6bc779d126ad9be89b5cfe6..140999c32bcfc1010eb5b9ec9705d82c0590acbb 100644 |
--- a/content/browser/service_worker/service_worker_test_utils.cc |
+++ b/content/browser/service_worker/service_worker_test_utils.cc |
@@ -7,6 +7,8 @@ |
#include <utility> |
#include "content/browser/service_worker/service_worker_provider_host.h" |
+#include "content/common/service_worker/service_worker_provider.mojom.h" |
+#include "content/public/common/child_process_host.h" |
namespace content { |
@@ -26,6 +28,12 @@ void ServiceWorkerRemoteProviderEndpoint::BindWithProviderHostInfo( |
info->host_request = mojo::MakeIsolatedRequest(&host_ptr_); |
} |
+void ServiceWorkerRemoteProviderEndpoint::BindWithProviderClientInfo( |
+ mojom::ServiceWorkerProviderClientInfo* info) { |
+ client_request_ = std::move(info->client_request); |
+ host_ptr_.Bind(std::move(info->host_ptr_info)); |
+} |
+ |
std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
int process_id, |
int provider_id, |
@@ -43,16 +51,21 @@ std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostForWindow( |
std::unique_ptr<ServiceWorkerProviderHost> |
CreateProviderHostForServiceWorkerContext( |
int process_id, |
- int provider_id, |
bool is_parent_frame_secure, |
+ ServiceWorkerVersion* hosted_version, |
base::WeakPtr<ServiceWorkerContextCore> context, |
ServiceWorkerRemoteProviderEndpoint* output_endpoint) { |
- ServiceWorkerProviderHostInfo info(provider_id, MSG_ROUTING_NONE, |
- SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, |
- is_parent_frame_secure); |
- output_endpoint->BindWithProviderHostInfo(&info); |
- return ServiceWorkerProviderHost::Create(process_id, std::move(info), |
- std::move(context), nullptr); |
+ ServiceWorkerProviderHostInfo info( |
+ kInvalidServiceWorkerProviderId, MSG_ROUTING_NONE, |
+ SERVICE_WORKER_PROVIDER_FOR_CONTROLLER, is_parent_frame_secure); |
+ std::unique_ptr<ServiceWorkerProviderHost> host = |
+ ServiceWorkerProviderHost::PreCreateForController(hosted_version, |
+ std::move(context)); |
+ mojom::ServiceWorkerProviderClientInfoPtr provider_client_info = |
+ mojom::ServiceWorkerProviderClientInfo::New(); |
+ host->CompleteStartWorkerPreparation(process_id, &provider_client_info); |
+ output_endpoint->BindWithProviderClientInfo(provider_client_info.get()); |
+ return host; |
} |
std::unique_ptr<ServiceWorkerProviderHost> CreateProviderHostWithDispatcherHost( |