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

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

Issue 303733002: Reparent SWProcessManager onto SWContextWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make sure the ContextCore is destroyed before checking that messages fail Created 6 years, 6 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_core.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper(int mock_render_process_id) 18 EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper(int mock_render_process_id)
19 : wrapper_(new ServiceWorkerContextWrapper(NULL)), 19 : wrapper_(new ServiceWorkerContextWrapper(NULL)),
20 next_thread_id_(0), 20 next_thread_id_(0),
21 weak_factory_(this) { 21 weak_factory_(this) {
22 wrapper_->InitInternal(base::FilePath(), 22 wrapper_->InitInternal(base::FilePath(),
23 base::MessageLoopProxy::current(), 23 base::MessageLoopProxy::current(),
24 base::MessageLoopProxy::current(), 24 base::MessageLoopProxy::current(),
25 NULL); 25 NULL);
26 scoped_ptr<ServiceWorkerProcessManager> process_manager( 26 wrapper_->process_manager()->SetProcessIdForTest(mock_render_process_id);
27 new ServiceWorkerProcessManager(wrapper_));
28 process_manager->SetProcessIdForTest(mock_render_process_id);
29 wrapper_->context()->SetProcessManagerForTest(process_manager.Pass());
30 registry()->AddChildProcessSender(mock_render_process_id, this); 27 registry()->AddChildProcessSender(mock_render_process_id, this);
31 } 28 }
32 29
33 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() { 30 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() {
34 if (wrapper_) 31 if (wrapper_)
35 wrapper_->Shutdown(); 32 wrapper_->Shutdown();
36 } 33 }
37 34
38 void EmbeddedWorkerTestHelper::SimulateAddProcessToWorker( 35 void EmbeddedWorkerTestHelper::SimulateAddProcessToWorker(
39 int embedded_worker_id, 36 int embedded_worker_id,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 request_id, 230 request_id,
234 request)); 231 request));
235 } 232 }
236 233
237 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { 234 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() {
238 DCHECK(context()); 235 DCHECK(context());
239 return context()->embedded_worker_registry(); 236 return context()->embedded_worker_registry();
240 } 237 }
241 238
242 } // namespace content 239 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698