| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 130 embedded_worker_id, |
| 131 request_id, | 131 request_id, |
| 132 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, | 132 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, |
| 133 ServiceWorkerResponse(200, "OK", | 133 ServiceWorkerResponse(GURL(""), |
| 134 200, |
| 135 "OK", |
| 134 std::map<std::string, std::string>(), | 136 std::map<std::string, std::string>(), |
| 135 std::string()))); | 137 std::string()))); |
| 136 } | 138 } |
| 137 | 139 |
| 138 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( | 140 void EmbeddedWorkerTestHelper::SimulateWorkerStarted( |
| 139 int thread_id, int embedded_worker_id) { | 141 int thread_id, int embedded_worker_id) { |
| 140 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 142 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
| 141 ASSERT_TRUE(worker != NULL); | 143 ASSERT_TRUE(worker != NULL); |
| 142 registry()->OnWorkerStarted( | 144 registry()->OnWorkerStarted( |
| 143 worker->process_id(), | 145 worker->process_id(), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 request_id, | 234 request_id, |
| 233 request)); | 235 request)); |
| 234 } | 236 } |
| 235 | 237 |
| 236 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 238 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
| 237 DCHECK(context()); | 239 DCHECK(context()); |
| 238 return context()->embedded_worker_registry(); | 240 return context()->embedded_worker_registry(); |
| 239 } | 241 } |
| 240 | 242 |
| 241 } // namespace content | 243 } // namespace content |
| OLD | NEW |