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/public/test/mock_render_process_host.h" | 5 #include "content/public/test/mock_render_process_host.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bool MockRenderProcessHost::FastShutdownStarted() const { | 115 bool MockRenderProcessHost::FastShutdownStarted() const { |
116 return fast_shutdown_started_; | 116 return fast_shutdown_started_; |
117 } | 117 } |
118 | 118 |
119 void MockRenderProcessHost::DumpHandles() { | 119 void MockRenderProcessHost::DumpHandles() { |
120 } | 120 } |
121 | 121 |
122 base::ProcessHandle MockRenderProcessHost::GetHandle() const { | 122 base::ProcessHandle MockRenderProcessHost::GetHandle() const { |
123 // Return the current-process handle for the IPC::GetFileHandleForProcess | 123 // Return the current-process handle for the IPC::GetFileHandleForProcess |
124 // function. | 124 // function. |
| 125 if (process_handle) |
| 126 return base::ProcessHandle(*process_handle); |
125 return base::Process::Current().handle(); | 127 return base::Process::Current().handle(); |
126 } | 128 } |
127 | 129 |
128 bool MockRenderProcessHost::Send(IPC::Message* msg) { | 130 bool MockRenderProcessHost::Send(IPC::Message* msg) { |
129 // Save the message in the sink. | 131 // Save the message in the sink. |
130 sink_.OnMessageReceived(*msg); | 132 sink_.OnMessageReceived(*msg); |
131 delete msg; | 133 delete msg; |
132 return true; | 134 return true; |
133 } | 135 } |
134 | 136 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 285 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
284 it != processes_.end(); ++it) { | 286 it != processes_.end(); ++it) { |
285 if (*it == host) { | 287 if (*it == host) { |
286 processes_.weak_erase(it); | 288 processes_.weak_erase(it); |
287 break; | 289 break; |
288 } | 290 } |
289 } | 291 } |
290 } | 292 } |
291 | 293 |
292 } // content | 294 } // content |
OLD | NEW |