| OLD | NEW |
| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 ASSERT_TRUE(worker != NULL); | 147 ASSERT_TRUE(worker != NULL); |
| 148 registry()->OnWorkerStarted( | 148 registry()->OnWorkerStarted( |
| 149 worker->process_id(), | 149 worker->process_id(), |
| 150 thread_id, | 150 thread_id, |
| 151 embedded_worker_id); | 151 embedded_worker_id); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void EmbeddedWorkerTestHelper::SimulateWorkerStopped( | 154 void EmbeddedWorkerTestHelper::SimulateWorkerStopped( |
| 155 int embedded_worker_id) { | 155 int embedded_worker_id) { |
| 156 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 156 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
| 157 ASSERT_TRUE(worker != NULL); | 157 if (worker != NULL) |
| 158 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); | 158 registry()->OnWorkerStopped(worker->process_id(), embedded_worker_id); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void EmbeddedWorkerTestHelper::SimulateSend( | 161 void EmbeddedWorkerTestHelper::SimulateSend( |
| 162 IPC::Message* message) { | 162 IPC::Message* message) { |
| 163 registry()->OnMessageReceived(*message); | 163 registry()->OnMessageReceived(*message); |
| 164 delete message; | 164 delete message; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void EmbeddedWorkerTestHelper::OnStartWorkerStub( | 167 void EmbeddedWorkerTestHelper::OnStartWorkerStub( |
| 168 const EmbeddedWorkerMsg_StartWorker_Params& params) { | 168 const EmbeddedWorkerMsg_StartWorker_Params& params) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 request_id, | 238 request_id, |
| 239 request)); | 239 request)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 242 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
| 243 DCHECK(context()); | 243 DCHECK(context()); |
| 244 return context()->embedded_worker_registry(); | 244 return context()->embedded_worker_registry(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 } // namespace content | 247 } // namespace content |
| OLD | NEW |