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

Side by Side Diff: content/browser/renderer_host/mock_render_process_host.cc

Issue 9360014: Create a content public browser API around the ChildProcessSecurityPolicy class. The implementati... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/mock_render_process_host.h" 5 #include "content/browser/renderer_host/mock_render_process_host.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "content/browser/child_process_security_policy.h" 10 #include "content/browser/child_process_security_policy_impl.h"
11 #include "content/browser/renderer_host/render_process_host_impl.h" 11 #include "content/browser/renderer_host/render_process_host_impl.h"
12 #include "content/common/child_process_host_impl.h" 12 #include "content/common/child_process_host_impl.h"
13 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 15
16 using content::ChildProcessHostImpl; 16 using content::ChildProcessHostImpl;
17 17
18 MockRenderProcessHost::MockRenderProcessHost( 18 MockRenderProcessHost::MockRenderProcessHost(
19 content::BrowserContext* browser_context) 19 content::BrowserContext* browser_context)
20 : transport_dib_(NULL), 20 : transport_dib_(NULL),
21 bad_msg_count_(0), 21 bad_msg_count_(0),
22 factory_(NULL), 22 factory_(NULL),
23 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), 23 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
24 browser_context_(browser_context), 24 browser_context_(browser_context),
25 fast_shutdown_started_(false) { 25 fast_shutdown_started_(false) {
26 // Child process security operations can't be unit tested unless we add 26 // Child process security operations can't be unit tested unless we add
27 // ourselves as an existing child process. 27 // ourselves as an existing child process.
28 ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); 28 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
29 29
30 RenderProcessHostImpl::RegisterHost(GetID(), this); 30 RenderProcessHostImpl::RegisterHost(GetID(), this);
31 } 31 }
32 32
33 MockRenderProcessHost::~MockRenderProcessHost() { 33 MockRenderProcessHost::~MockRenderProcessHost() {
34 ChildProcessSecurityPolicy::GetInstance()->Remove(GetID()); 34 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID());
35 delete transport_dib_; 35 delete transport_dib_;
36 if (factory_) 36 if (factory_)
37 factory_->Remove(this); 37 factory_->Remove(this);
38 // In unit tests, Release() might not have been called. 38 // In unit tests, Release() might not have been called.
39 RenderProcessHostImpl::UnregisterHost(GetID()); 39 RenderProcessHostImpl::UnregisterHost(GetID());
40 } 40 }
41 41
42 void MockRenderProcessHost::EnableSendQueue() { 42 void MockRenderProcessHost::EnableSendQueue() {
43 } 43 }
44 44
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { 241 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const {
242 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); 242 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin();
243 it != processes_.end(); ++it) { 243 it != processes_.end(); ++it) {
244 if (*it == host) { 244 if (*it == host) {
245 processes_.weak_erase(it); 245 processes_.weak_erase(it);
246 break; 246 break;
247 } 247 }
248 } 248 }
249 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698