| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void EmbeddedWorkerTestHelper::SimulateSend( | 138 void EmbeddedWorkerTestHelper::SimulateSend( |
| 139 IPC::Message* message) { | 139 IPC::Message* message) { |
| 140 registry()->OnMessageReceived(*message); | 140 registry()->OnMessageReceived(*message); |
| 141 delete message; | 141 delete message; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void EmbeddedWorkerTestHelper::OnStartWorkerStub( | 144 void EmbeddedWorkerTestHelper::OnStartWorkerStub( |
| 145 int embedded_worker_id, | 145 int embedded_worker_id, |
| 146 int64 service_worker_version_id, | 146 int64 service_worker_version_id, |
| 147 const GURL& scope, | 147 const GURL& scope, |
| 148 const GURL& script_url) { | 148 const GURL& script_url, |
| 149 int worker_devtools_agent_route_id) { |
| 149 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); | 150 EmbeddedWorkerInstance* worker = registry()->GetWorker(embedded_worker_id); |
| 150 ASSERT_TRUE(worker != NULL); | 151 ASSERT_TRUE(worker != NULL); |
| 151 EXPECT_EQ(EmbeddedWorkerInstance::STARTING, worker->status()); | 152 EXPECT_EQ(EmbeddedWorkerInstance::STARTING, worker->status()); |
| 152 base::MessageLoopProxy::current()->PostTask( | 153 base::MessageLoopProxy::current()->PostTask( |
| 153 FROM_HERE, | 154 FROM_HERE, |
| 154 base::Bind(&EmbeddedWorkerTestHelper::OnStartWorker, | 155 base::Bind(&EmbeddedWorkerTestHelper::OnStartWorker, |
| 155 weak_factory_.GetWeakPtr(), | 156 weak_factory_.GetWeakPtr(), |
| 156 embedded_worker_id, | 157 embedded_worker_id, |
| 157 service_worker_version_id, | 158 service_worker_version_id, |
| 158 scope, | 159 scope, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 request_id, | 218 request_id, |
| 218 request)); | 219 request)); |
| 219 } | 220 } |
| 220 | 221 |
| 221 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 222 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
| 222 DCHECK(context_); | 223 DCHECK(context_); |
| 223 return context_->embedded_worker_registry(); | 224 return context_->embedded_worker_registry(); |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace content | 227 } // namespace content |
| OLD | NEW |