Index: content/browser/service_worker/embedded_worker_test_helper.cc |
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc |
index 3485ac1987f2bbef0cb9b690ad829564a0a4b118..9ab9013271953f7a3a0f978144423e504d03ab72 100644 |
--- a/content/browser/service_worker/embedded_worker_test_helper.cc |
+++ b/content/browser/service_worker/embedded_worker_test_helper.cc |
@@ -73,7 +73,8 @@ EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient:: |
void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( |
const EmbeddedWorkerStartParams& params, |
mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, |
- mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) { |
+ mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host, |
+ mojom::ServiceWorkerProviderInfoForStartWorkerPtr provider_info) { |
if (!helper_) |
return; |
@@ -85,7 +86,8 @@ void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StartWorker( |
EXPECT_EQ(EmbeddedWorkerStatus::STARTING, worker->status()); |
helper_->OnStartWorkerStub(params, std::move(dispatcher_request), |
- std::move(instance_host)); |
+ std::move(instance_host), |
+ std::move(provider_info)); |
} |
void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::StopWorker() { |
@@ -290,7 +292,6 @@ EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper( |
wrapper_(new ServiceWorkerContextWrapper(browser_context_.get())), |
mock_instance_clients_next_index_(0), |
next_thread_id_(0), |
- next_provider_id_(1000), |
mock_render_process_id_(render_process_host_->GetID()), |
new_mock_render_process_id_(new_render_process_host_->GetID()), |
weak_factory_(this) { |
@@ -395,7 +396,8 @@ void EmbeddedWorkerTestHelper::OnStartWorker( |
const GURL& script_url, |
bool pause_after_download, |
mojom::ServiceWorkerEventDispatcherRequest request, |
- mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) { |
+ mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host, |
+ mojom::ServiceWorkerProviderInfoForStartWorkerPtr provider_info) { |
EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
ASSERT_TRUE(worker); |
MockServiceWorkerEventDispatcher::Create(AsWeakPtr(), worker->thread_id(), |
@@ -405,6 +407,9 @@ void EmbeddedWorkerTestHelper::OnStartWorker( |
service_worker_version_id; |
embedded_worker_id_instance_host_ptr_map_[embedded_worker_id].Bind( |
std::move(instance_host)); |
+ ServiceWorkerRemoteProviderEndpoint* provider_endpoint = |
+ &embedded_worker_id_remote_provider_map_[embedded_worker_id]; |
+ provider_endpoint->BindWithProviderInfo(std::move(provider_info)); |
SimulateWorkerReadyForInspection(embedded_worker_id); |
SimulateWorkerScriptCached(embedded_worker_id); |
@@ -414,8 +419,7 @@ void EmbeddedWorkerTestHelper::OnStartWorker( |
} |
void EmbeddedWorkerTestHelper::OnResumeAfterDownload(int embedded_worker_id) { |
- SimulateWorkerThreadStarted(GetNextThreadId(), embedded_worker_id, |
- GetNextProviderId()); |
+ SimulateWorkerThreadStarted(GetNextThreadId(), embedded_worker_id); |
SimulateWorkerScriptEvaluated(embedded_worker_id, true /* success */); |
SimulateWorkerStarted(embedded_worker_id); |
} |
@@ -576,22 +580,12 @@ void EmbeddedWorkerTestHelper::SimulateWorkerScriptLoaded( |
void EmbeddedWorkerTestHelper::SimulateWorkerThreadStarted( |
int thread_id, |
- int embedded_worker_id, |
- int provider_id) { |
+ int embedded_worker_id) { |
EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
ASSERT_TRUE(worker); |
ASSERT_TRUE(embedded_worker_id_instance_host_ptr_map_[embedded_worker_id]); |
- |
- // Prepare a provider host to be used by following OnThreadStarted(). |
- std::unique_ptr<ServiceWorkerProviderHost> host = |
- CreateProviderHostForServiceWorkerContext( |
- worker->process_id(), provider_id, true /* is_parent_frame_secure */, |
- context()->AsWeakPtr(), |
- &embedded_worker_id_remote_provider_map_[embedded_worker_id]); |
- context()->AddProviderHost(std::move(host)); |
- |
embedded_worker_id_instance_host_ptr_map_[embedded_worker_id] |
- ->OnThreadStarted(thread_id, provider_id); |
+ ->OnThreadStarted(thread_id); |
base::RunLoop().RunUntilIdle(); |
} |
@@ -631,7 +625,8 @@ void EmbeddedWorkerTestHelper::SimulateSend(IPC::Message* message) { |
void EmbeddedWorkerTestHelper::OnStartWorkerStub( |
const EmbeddedWorkerStartParams& params, |
mojom::ServiceWorkerEventDispatcherRequest request, |
- mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host) { |
+ mojom::EmbeddedWorkerInstanceHostAssociatedPtrInfo instance_host, |
+ mojom::ServiceWorkerProviderInfoForStartWorkerPtr provider_info) { |
EmbeddedWorkerInstance* worker = |
registry()->GetWorker(params.embedded_worker_id); |
ASSERT_TRUE(worker); |
@@ -641,7 +636,8 @@ void EmbeddedWorkerTestHelper::OnStartWorkerStub( |
base::Bind(&EmbeddedWorkerTestHelper::OnStartWorker, AsWeakPtr(), |
params.embedded_worker_id, params.service_worker_version_id, |
params.scope, params.script_url, params.pause_after_download, |
- base::Passed(&request), base::Passed(&instance_host))); |
+ base::Passed(&request), base::Passed(&instance_host), |
+ base::Passed(&provider_info))); |
} |
void EmbeddedWorkerTestHelper::OnResumeAfterDownloadStub( |