OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/child_process_security_policy.h" | 7 #include "content/browser/child_process_security_policy.h" |
8 | 8 |
9 MockRenderProcessHost::MockRenderProcessHost(Profile* profile) | 9 MockRenderProcessHost::MockRenderProcessHost(Profile* profile) |
10 : RenderProcessHost(profile), | 10 : RenderProcessHost(profile), |
11 transport_dib_(NULL), | 11 transport_dib_(NULL), |
12 bad_msg_count_(0), | 12 bad_msg_count_(0), |
13 factory_(NULL) { | 13 factory_(NULL) { |
14 // Child process security operations can't be unit tested unless we add | 14 // Child process security operations can't be unit tested unless we add |
15 // ourselves as an existing child process. | 15 // ourselves as an existing child process. |
16 ChildProcessSecurityPolicy::GetInstance()->Add(id()); | 16 ChildProcessSecurityPolicy::GetInstance()->Add(id()); |
17 } | 17 } |
18 | 18 |
19 MockRenderProcessHost::~MockRenderProcessHost() { | 19 MockRenderProcessHost::~MockRenderProcessHost() { |
20 ChildProcessSecurityPolicy::GetInstance()->Remove(id()); | 20 ChildProcessSecurityPolicy::GetInstance()->Remove(id()); |
21 delete transport_dib_; | 21 delete transport_dib_; |
22 if (factory_) | 22 if (factory_) |
23 factory_->Remove(this); | 23 factory_->Remove(this); |
24 } | 24 } |
25 | 25 |
| 26 void MockRenderProcessHost::EnableSendQueue() { |
| 27 } |
| 28 |
26 bool MockRenderProcessHost::Init(bool is_accessibility_enabled) { | 29 bool MockRenderProcessHost::Init(bool is_accessibility_enabled) { |
27 return true; | 30 return true; |
28 } | 31 } |
29 | 32 |
30 int MockRenderProcessHost::GetNextRoutingID() { | 33 int MockRenderProcessHost::GetNextRoutingID() { |
31 static int prev_routing_id = 0; | 34 static int prev_routing_id = 0; |
32 return ++prev_routing_id; | 35 return ++prev_routing_id; |
33 } | 36 } |
34 | 37 |
35 void MockRenderProcessHost::CancelResourceRequests(int render_widget_id) { | 38 void MockRenderProcessHost::CancelResourceRequests(int render_widget_id) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 133 |
131 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { | 134 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { |
132 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 135 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
133 it != processes_.end(); ++it) { | 136 it != processes_.end(); ++it) { |
134 if (*it == host) { | 137 if (*it == host) { |
135 processes_.weak_erase(it); | 138 processes_.weak_erase(it); |
136 break; | 139 break; |
137 } | 140 } |
138 } | 141 } |
139 } | 142 } |
OLD | NEW |