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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 embedded_worker_id, request_id, | 128 embedded_worker_id, request_id, |
129 blink::WebServiceWorkerEventResultCompleted)); | 129 blink::WebServiceWorkerEventResultCompleted)); |
130 } | 130 } |
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, |
| 139 request_id, |
139 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, | 140 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, |
140 ServiceWorkerResponse(200, "OK", "GET", | 141 ServiceWorkerResponse(200, "OK", "GET", |
141 std::map<std::string, std::string>()))); | 142 std::map<std::string, std::string>(), |
| 143 std::string()))); |
142 } | 144 } |
143 | 145 |
144 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( | 146 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( |
145 int thread_id, int embedded_worker_id) { | 147 int thread_id, int embedded_worker_id) { |
146 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 148 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
147 ASSERT_TRUE(worker != NULL); | 149 ASSERT_TRUE(worker != NULL); |
148 registry()->OnWorkerStarted( | 150 registry()->OnWorkerStarted( |
149 worker->process_id(), | 151 worker->process_id(), |
150 thread_id, | 152 thread_id, |
151 embedded_worker_id); | 153 embedded_worker_id); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 request_id, | 240 request_id, |
239 request)); | 241 request)); |
240 } | 242 } |
241 | 243 |
242 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 244 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
243 DCHECK(context()); | 245 DCHECK(context()); |
244 return context()->embedded_worker_registry(); | 246 return context()->embedded_worker_registry(); |
245 } | 247 } |
246 | 248 |
247 } // namespace content | 249 } // namespace content |
OLD | NEW |