| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 embedded_worker_id, request_id, | 120 embedded_worker_id, request_id, |
| 121 blink::WebServiceWorkerEventResultCompleted)); | 121 blink::WebServiceWorkerEventResultCompleted)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void EmbeddedWorkerTestHelper::OnFetchEvent( | 124 void EmbeddedWorkerTestHelper::OnFetchEvent( |
| 125 int embedded_worker_id, | 125 int embedded_worker_id, |
| 126 int request_id, | 126 int request_id, |
| 127 const ServiceWorkerFetchRequest& request) { | 127 const ServiceWorkerFetchRequest& request) { |
| 128 SimulateSend( | 128 SimulateSend( |
| 129 new ServiceWorkerHostMsg_FetchEventFinished( | 129 new ServiceWorkerHostMsg_FetchEventFinished( |
| 130 embedded_worker_id, request_id, | 130 embedded_worker_id, |
| 131 request_id, |
| 131 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, | 132 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, |
| 132 ServiceWorkerResponse(200, "OK", | 133 ServiceWorkerResponse(200, "OK", |
| 133 std::map<std::string, std::string>()))); | 134 std::map<std::string, std::string>(), |
| 135 std::string()))); |
| 134 } | 136 } |
| 135 | 137 |
| 136 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( | 138 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( |
| 137 int thread_id, int embedded_worker_id) { | 139 int thread_id, int embedded_worker_id) { |
| 138 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 140 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
| 139 ASSERT_TRUE(worker != NULL); | 141 ASSERT_TRUE(worker != NULL); |
| 140 registry()->OnWorkerStarted( | 142 registry()->OnWorkerStarted( |
| 141 worker->process_id(), | 143 worker->process_id(), |
| 142 thread_id, | 144 thread_id, |
| 143 embedded_worker_id); | 145 embedded_worker_id); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 request_id, | 232 request_id, |
| 231 request)); | 233 request)); |
| 232 } | 234 } |
| 233 | 235 |
| 234 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 236 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
| 235 DCHECK(context()); | 237 DCHECK(context()); |
| 236 return context()->embedded_worker_registry(); | 238 return context()->embedded_worker_registry(); |
| 237 } | 239 } |
| 238 | 240 |
| 239 } // namespace content | 241 } // namespace content |
| OLD | NEW |