Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(979)

Side by Side Diff: content/browser/service_worker/embedded_worker_test_helper.cc

Issue 292903002: Save running SW instance info, including its SiteInstance, into the ProcessManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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) {
19 return true;
20 }
21
22 EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper(int mock_render_process_id) 18 EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper(int mock_render_process_id)
23 : wrapper_(new ServiceWorkerContextWrapper(NULL)), 19 : wrapper_(new ServiceWorkerContextWrapper(NULL)),
24 next_thread_id_(0), 20 next_thread_id_(0),
25 weak_factory_(this) { 21 weak_factory_(this) {
26 wrapper_->InitInternal(base::FilePath(), 22 wrapper_->InitInternal(base::FilePath(),
27 base::MessageLoopProxy::current(), 23 base::MessageLoopProxy::current(),
28 base::MessageLoopProxy::current(), 24 base::MessageLoopProxy::current(),
29 NULL); 25 NULL);
30 scoped_ptr<ServiceWorkerProcessManager> process_manager( 26 scoped_ptr<ServiceWorkerProcessManager> process_manager(
31 new ServiceWorkerProcessManager(wrapper_)); 27 new ServiceWorkerProcessManager(wrapper_));
32 process_manager->SetProcessRefcountOpsForTest(base::Bind(AlwaysTrue), 28 process_manager->SetProcessIdForTest(mock_render_process_id);
33 base::Bind(AlwaysTrue));
34 wrapper_->context()->SetProcessManagerForTest(process_manager.Pass()); 29 wrapper_->context()->SetProcessManagerForTest(process_manager.Pass());
35 registry()->AddChildProcessSender(mock_render_process_id, this); 30 registry()->AddChildProcessSender(mock_render_process_id, this);
36 } 31 }
37 32
38 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() { 33 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() {
39 if (wrapper_) 34 if (wrapper_)
40 wrapper_->Shutdown(); 35 wrapper_->Shutdown();
41 } 36 }
42 37
43 void EmbeddedWorkerTestHelper::SimulateAddProcessToWorker( 38 void EmbeddedWorkerTestHelper::SimulateAddProcessToWorker(
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 request_id, 233 request_id,
239 request)); 234 request));
240 } 235 }
241 236
242 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { 237 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
243 DCHECK(context()); 238 DCHECK(context());
244 return context()->embedded_worker_registry(); 239 return context()->embedded_worker_registry();
245 } 240 }
246 241
247 } // namespace content 242 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698