OLD | NEW |
---|---|
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_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 return listeners_iterator(&listeners); | 206 return listeners_iterator(&listeners); |
207 } | 207 } |
208 | 208 |
209 bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { | 209 bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { |
210 return false; | 210 return false; |
211 } | 211 } |
212 | 212 |
213 void MockRenderProcessHost::OnChannelConnected(int32 peer_pid) { | 213 void MockRenderProcessHost::OnChannelConnected(int32 peer_pid) { |
214 } | 214 } |
215 | 215 |
216 bool MockRenderProcessHost::AllowTerminateOnUnresponsive() const { | |
217 if (listeners_.size() > 1) | |
218 return false; | |
Charlie Reis
2012/03/01 21:08:17
Is this necessary for tests? Usually the Mock ver
nasko
2012/03/01 22:50:15
Is there a reason to have a hardcoded value, espec
Charlie Reis
2012/03/02 00:16:43
In general, it might get out of date if we change
nasko
2012/03/02 18:40:36
If the function is now renamed to IsSharedByMultip
Charlie Reis
2012/03/02 19:17:02
No, we can leave it as is.
| |
219 | |
220 return true; | |
221 } | |
222 | |
216 MockRenderProcessHostFactory::MockRenderProcessHostFactory() {} | 223 MockRenderProcessHostFactory::MockRenderProcessHostFactory() {} |
217 | 224 |
218 MockRenderProcessHostFactory::~MockRenderProcessHostFactory() { | 225 MockRenderProcessHostFactory::~MockRenderProcessHostFactory() { |
219 // Detach this object from MockRenderProcesses to prevent STLDeleteElements() | 226 // Detach this object from MockRenderProcesses to prevent STLDeleteElements() |
220 // from calling MockRenderProcessHostFactory::Remove(). | 227 // from calling MockRenderProcessHostFactory::Remove(). |
221 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 228 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
222 it != processes_.end(); ++it) { | 229 it != processes_.end(); ++it) { |
223 (*it)->SetFactory(NULL); | 230 (*it)->SetFactory(NULL); |
224 } | 231 } |
225 } | 232 } |
(...skipping 11 matching lines...) Expand all Loading... | |
237 | 244 |
238 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { | 245 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { |
239 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 246 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
240 it != processes_.end(); ++it) { | 247 it != processes_.end(); ++it) { |
241 if (*it == host) { | 248 if (*it == host) { |
242 processes_.weak_erase(it); | 249 processes_.weak_erase(it); |
243 break; | 250 break; |
244 } | 251 } |
245 } | 252 } |
246 } | 253 } |
OLD | NEW |