Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: content/browser/service_worker/foreign_fetch_request_handler_unittest.cc

Issue 2779763004: Create ServiceWorkerProviderHost before starting worker (Closed)
Patch Set: Pass the param of BindWithProviderInfo by value instead of pointer Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/foreign_fetch_request_handler_unittest.cc
diff --git a/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc b/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc
index d83152d006e2633be5855ee75e553c9656c5cdf1..927788c1b1c7500d4113aa0a0f2f0b806b8d118a 100644
--- a/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc
+++ b/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc
@@ -171,17 +171,6 @@ class ForeignFetchRequestHandlerTest : public testing::Test {
}
void CreateServiceWorkerTypeProviderHost() {
- remote_endpoints_.emplace_back();
- std::unique_ptr<ServiceWorkerProviderHost> host =
- CreateProviderHostForServiceWorkerContext(
- helper_->mock_render_process_id(), kMockProviderId,
- true /* is_parent_frame_secure */, helper_->context()->AsWeakPtr(),
- &remote_endpoints_.back());
- EXPECT_FALSE(
- context()->GetProviderHost(host->process_id(), host->provider_id()));
- provider_host_ = host->AsWeakPtr();
- context()->AddProviderHost(std::move(host));
-
// Create another worker whose requests will be intercepted by the foreign
// fetch event handler.
scoped_refptr<ServiceWorkerRegistration> registration =
@@ -204,7 +193,16 @@ class ForeignFetchRequestHandlerTest : public testing::Test {
base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
base::RunLoop().RunUntilIdle();
- provider_host_->running_hosted_version_ = version;
+ remote_endpoints_.emplace_back();
+ std::unique_ptr<ServiceWorkerProviderHost> host =
+ CreateProviderHostForServiceWorkerContext(
+ helper_->mock_render_process_id(),
+ true /* is_parent_frame_secure */, version.get(),
+ helper_->context()->AsWeakPtr(), &remote_endpoints_.back());
+ EXPECT_FALSE(
+ context()->GetProviderHost(host->process_id(), host->provider_id()));
+ provider_host_ = host->AsWeakPtr();
+ context()->AddProviderHost(std::move(host));
}
private:

Powered by Google App Engine
This is Rietveld 408576698