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

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

Issue 252633003: Introduce worker_devtools_agent_route_id for EmbeddedWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/embedded_worker_test_helper.h" 5 #include "content/browser/service_worker/embedded_worker_test_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/service_worker/embedded_worker_instance.h" 8 #include "content/browser/service_worker/embedded_worker_instance.h"
9 #include "content/browser/service_worker/embedded_worker_registry.h" 9 #include "content/browser/service_worker/embedded_worker_registry.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); 155 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id);
156 } 156 }
157 157
158 void EmbeddedWorkerTestHelper::SimulateSend( 158 void EmbeddedWorkerTestHelper::SimulateSend(
159 IPC::Message* message) { 159 IPC::Message* message) {
160 registry()->OnMessageReceived(*message); 160 registry()->OnMessageReceived(*message);
161 delete message; 161 delete message;
162 } 162 }
163 163
164 void EmbeddedWorkerTestHelper::OnStartWorkerStub( 164 void EmbeddedWorkerTestHelper::OnStartWorkerStub(
165 int embedded_worker_id, 165 const EmbeddedWorkerMsg_StartWorker_Params& params) {
166 int64 service_worker_version_id, 166 EmbeddedWorkerInstance* worker =
167 const GURL& scope, 167 registry()->GetWorker(params.embedded_worker_id);
168 const GURL& script_url) {
169 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id);
170 ASSERT_TRUE(worker != NULL); 168 ASSERT_TRUE(worker != NULL);
171 EXPECT_EQ(EmbeddedWorkerInstance::STARTING, worker->status()); 169 EXPECT_EQ(EmbeddedWorkerInstance::STARTING, worker->status());
172 base::MessageLoopProxy::current()->PostTask( 170 base::MessageLoopProxy::current()->PostTask(
173 FROM_HERE, 171 FROM_HERE,
174 base::Bind(&EmbeddedWorkerTestHelper::OnStartWorker, 172 base::Bind(&EmbeddedWorkerTestHelper::OnStartWorker,
175 weak_factory_.GetWeakPtr(), 173 weak_factory_.GetWeakPtr(),
176 embedded_worker_id, 174 params.embedded_worker_id,
177 service_worker_version_id, 175 params.service_worker_version_id,
178 scope, 176 params.scope,
179 script_url)); 177 params.script_url));
180 } 178 }
181 179
182 void EmbeddedWorkerTestHelper::OnStopWorkerStub(int embedded_worker_id) { 180 void EmbeddedWorkerTestHelper::OnStopWorkerStub(int embedded_worker_id) {
183 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); 181 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id);
184 ASSERT_TRUE(worker != NULL); 182 ASSERT_TRUE(worker != NULL);
185 base::MessageLoopProxy::current()->PostTask( 183 base::MessageLoopProxy::current()->PostTask(
186 FROM_HERE, 184 FROM_HERE,
187 base::Bind(&EmbeddedWorkerTestHelper::OnStopWorker, 185 base::Bind(&EmbeddedWorkerTestHelper::OnStopWorker,
188 weak_factory_.GetWeakPtr(), 186 weak_factory_.GetWeakPtr(),
189 embedded_worker_id)); 187 embedded_worker_id));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 request_id, 235 request_id,
238 request)); 236 request));
239 } 237 }
240 238
241 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { 239 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
242 DCHECK(context()); 240 DCHECK(context());
243 return context()->embedded_worker_registry(); 241 return context()->embedded_worker_registry();
244 } 242 }
245 243
246 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_test_helper.h ('k') | content/common/service_worker/embedded_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698