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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void EmbeddedWorkerTestHelper::OnFetchEvent( | 132 void EmbeddedWorkerTestHelper::OnFetchEvent( |
133 int embedded_worker_id, | 133 int embedded_worker_id, |
134 int request_id, | 134 int request_id, |
135 const ServiceWorkerFetchRequest& request) { | 135 const ServiceWorkerFetchRequest& request) { |
136 SimulateSend( | 136 SimulateSend( |
137 new ServiceWorkerHostMsg_FetchEventFinished( | 137 new ServiceWorkerHostMsg_FetchEventFinished( |
138 embedded_worker_id, request_id, | 138 embedded_worker_id, request_id, |
139 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, | 139 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, |
140 ServiceWorkerResponse(200, "OK", "GET", | 140 ServiceWorkerResponse(200, "OK", "GET", |
141 std::map<std::string, std::string>()))); | 141 std::map<std::string, std::string>(), |
| 142 std::string()))); |
142 } | 143 } |
143 | 144 |
144 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( | 145 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( |
145 int thread_id, int embedded_worker_id) { | 146 int thread_id, int embedded_worker_id) { |
146 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 147 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
147 ASSERT_TRUE(worker != NULL); | 148 ASSERT_TRUE(worker != NULL); |
148 registry()->OnWorkerStarted( | 149 registry()->OnWorkerStarted( |
149 worker->process_id(), | 150 worker->process_id(), |
150 thread_id, | 151 thread_id, |
151 embedded_worker_id); | 152 embedded_worker_id); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 request_id, | 239 request_id, |
239 request)); | 240 request)); |
240 } | 241 } |
241 | 242 |
242 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 243 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
243 DCHECK(context()); | 244 DCHECK(context()); |
244 return context()->embedded_worker_registry(); | 245 return context()->embedded_worker_registry(); |
245 } | 246 } |
246 | 247 |
247 } // namespace content | 248 } // namespace content |
OLD | NEW |