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

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

Issue 2779763004: Create ServiceWorkerProviderHost before starting worker (Closed)
Patch Set: Fix ForeignFetchRequestHandlerTest.InitializeHandler_TimeoutBehaviorForServiceWorker 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/service_worker_handle_unittest.cc
diff --git a/content/browser/service_worker/service_worker_handle_unittest.cc b/content/browser/service_worker/service_worker_handle_unittest.cc
index f3cdc096996ce197f1edbda929c0b4855a5d3b29..76ecd4e421074d4d7dbd307af765b69b38e09531 100644
--- a/content/browser/service_worker/service_worker_handle_unittest.cc
+++ b/content/browser/service_worker/service_worker_handle_unittest.cc
@@ -46,16 +46,12 @@ void VerifyStateChangedMessage(int expected_handle_id,
class TestingServiceWorkerDispatcherHost : public ServiceWorkerDispatcherHost {
public:
- TestingServiceWorkerDispatcherHost(
- int process_id,
- ServiceWorkerContextWrapper* context_wrapper,
- ResourceContext* resource_context,
- EmbeddedWorkerTestHelper* helper)
+ TestingServiceWorkerDispatcherHost(int process_id,
+ ResourceContext* resource_context,
+ EmbeddedWorkerTestHelper* helper)
: ServiceWorkerDispatcherHost(process_id, resource_context),
bad_message_received_count_(0),
- helper_(helper) {
- Init(context_wrapper);
- }
+ helper_(helper) {}
bool Send(IPC::Message* message) override { return helper_->Send(message); }
@@ -76,10 +72,11 @@ class ServiceWorkerHandleTest : public testing::Test {
void SetUp() override {
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
- helper_->context()->RemoveDispatcherHost(helper_->mock_render_process_id());
dispatcher_host_ = new TestingServiceWorkerDispatcherHost(
- helper_->mock_render_process_id(), helper_->context_wrapper(),
- &resource_context_, helper_.get());
+ helper_->mock_render_process_id(), &resource_context_, helper_.get());
+ helper_->RegisterMockDispatcherHost(helper_->mock_render_process_id(),
+ dispatcher_host_);
+ dispatcher_host_->Init(helper_->context_wrapper());
const GURL pattern("http://www.example.com/");
registration_ = new ServiceWorkerRegistration(

Powered by Google App Engine
This is Rietveld 408576698