| 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" |
| 11 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 11 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 12 #include "content/common/service_worker/embedded_worker_messages.h" | 12 #include "content/common/service_worker/embedded_worker_messages.h" |
| 13 #include "content/common/service_worker/service_worker_messages.h" | 13 #include "content/common/service_worker/service_worker_messages.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 static bool AlwaysTrue(int process_id) { | 18 static bool AlwaysTrue(int process_id) { |
| 19 return true; | 19 return true; |
| 20 } | 20 } |
| 21 | 21 |
| 22 EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper(int mock_render_process_id) | 22 EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper(int mock_render_process_id) |
| 23 : wrapper_(new ServiceWorkerContextWrapper(NULL)), | 23 : wrapper_(new ServiceWorkerContextWrapper(NULL)), |
| 24 next_thread_id_(0), | 24 next_thread_id_(0), |
| 25 weak_factory_(this) { | 25 weak_factory_(this) { |
| 26 wrapper_->Init(base::FilePath(), NULL); | 26 wrapper_->InitForTesting(base::FilePath(), |
| 27 base::MessageLoopProxy::current(), |
| 28 NULL); |
| 27 scoped_ptr<ServiceWorkerProcessManager> process_manager( | 29 scoped_ptr<ServiceWorkerProcessManager> process_manager( |
| 28 new ServiceWorkerProcessManager(wrapper_)); | 30 new ServiceWorkerProcessManager(wrapper_)); |
| 29 process_manager->SetProcessRefcountOpsForTest(base::Bind(AlwaysTrue), | 31 process_manager->SetProcessRefcountOpsForTest(base::Bind(AlwaysTrue), |
| 30 base::Bind(AlwaysTrue)); | 32 base::Bind(AlwaysTrue)); |
| 31 wrapper_->context()->SetProcessManagerForTest(process_manager.Pass()); | 33 wrapper_->context()->SetProcessManagerForTest(process_manager.Pass()); |
| 32 registry()->AddChildProcessSender(mock_render_process_id, this); | 34 registry()->AddChildProcessSender(mock_render_process_id, this); |
| 33 } | 35 } |
| 34 | 36 |
| 35 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() { | 37 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() { |
| 36 if (wrapper_) | 38 if (wrapper_) |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 request_id, | 237 request_id, |
| 236 request)); | 238 request)); |
| 237 } | 239 } |
| 238 | 240 |
| 239 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 241 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
| 240 DCHECK(context()); | 242 DCHECK(context()); |
| 241 return context()->embedded_worker_registry(); | 243 return context()->embedded_worker_registry(); |
| 242 } | 244 } |
| 243 | 245 |
| 244 } // namespace content | 246 } // namespace content |
| OLD | NEW |