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

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host_unittest.cc

Issue 303733002: Reparent SWProcessManager onto SWContextWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make sure the ContextCore is destroyed before checking that messages fail Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/browser_thread_impl.h" 10 #include "content/browser/browser_thread_impl.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 switches::kEnableServiceWorker)); 124 switches::kEnableServiceWorker));
125 CommandLine::ForCurrentProcess()->AppendSwitch( 125 CommandLine::ForCurrentProcess()->AppendSwitch(
126 switches::kEnableServiceWorker); 126 switches::kEnableServiceWorker);
127 127
128 scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host = 128 scoped_refptr<TestingServiceWorkerDispatcherHost> dispatcher_host =
129 new TestingServiceWorkerDispatcherHost( 129 new TestingServiceWorkerDispatcherHost(
130 kRenderProcessId, context_wrapper(), helper_.get()); 130 kRenderProcessId, context_wrapper(), helper_.get());
131 131
132 helper_->ShutdownContext(); 132 helper_->ShutdownContext();
133 133
134 // Let the shutdown reach the simulated IO thread.
135 base::RunLoop().RunUntilIdle();
136
134 dispatcher_host->OnMessageReceived( 137 dispatcher_host->OnMessageReceived(
135 ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, -1, GURL(), GURL())); 138 ServiceWorkerHostMsg_RegisterServiceWorker(-1, -1, -1, GURL(), GURL()));
136 139
137 // TODO(alecflett): Pump the message loop when this becomes async. 140 // TODO(alecflett): Pump the message loop when this becomes async.
138 ASSERT_EQ(1UL, dispatcher_host->ipc_sink()->message_count()); 141 ASSERT_EQ(1UL, dispatcher_host->ipc_sink()->message_count());
139 EXPECT_TRUE(dispatcher_host->ipc_sink()->GetUniqueMessageMatching( 142 EXPECT_TRUE(dispatcher_host->ipc_sink()->GetUniqueMessageMatching(
140 ServiceWorkerMsg_ServiceWorkerRegistrationError::ID)); 143 ServiceWorkerMsg_ServiceWorkerRegistrationError::ID));
141 } 144 }
142 145
143 TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) { 146 TEST_F(ServiceWorkerDispatcherHostTest, ProviderCreatedAndDestroyed) {
(...skipping 25 matching lines...) Expand all
169 // process to get deleted as well. 172 // process to get deleted as well.
170 dispatcher_host->OnMessageReceived( 173 dispatcher_host->OnMessageReceived(
171 ServiceWorkerHostMsg_ProviderCreated(kProviderId)); 174 ServiceWorkerHostMsg_ProviderCreated(kProviderId));
172 EXPECT_TRUE(context()->GetProviderHost(kRenderProcessId, kProviderId)); 175 EXPECT_TRUE(context()->GetProviderHost(kRenderProcessId, kProviderId));
173 EXPECT_TRUE(dispatcher_host->HasOneRef()); 176 EXPECT_TRUE(dispatcher_host->HasOneRef());
174 dispatcher_host = NULL; 177 dispatcher_host = NULL;
175 EXPECT_FALSE(context()->GetProviderHost(kRenderProcessId, kProviderId)); 178 EXPECT_FALSE(context()->GetProviderHost(kRenderProcessId, kProviderId));
176 } 179 }
177 180
178 } // namespace content 181 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698