| 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.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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 RenderProcessHostImpl::RegisterHost(GetID(), this); | 30 RenderProcessHostImpl::RegisterHost(GetID(), this); |
| 31 } | 31 } |
| 32 | 32 |
| 33 MockRenderProcessHost::~MockRenderProcessHost() { | 33 MockRenderProcessHost::~MockRenderProcessHost() { |
| 34 ChildProcessSecurityPolicyImpl::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(), this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void MockRenderProcessHost::EnableSendQueue() { | 42 void MockRenderProcessHost::EnableSendQueue() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool MockRenderProcessHost::Init() { | 45 bool MockRenderProcessHost::Init() { |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 int MockRenderProcessHost::GetNextRoutingID() { | 49 int MockRenderProcessHost::GetNextRoutingID() { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 Cleanup(); | 158 Cleanup(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void MockRenderProcessHost::Cleanup() { | 161 void MockRenderProcessHost::Cleanup() { |
| 162 if (render_widget_hosts_.IsEmpty()) { | 162 if (render_widget_hosts_.IsEmpty()) { |
| 163 NotificationService::current()->Notify( | 163 NotificationService::current()->Notify( |
| 164 NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 164 NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 165 Source<RenderProcessHost>(this), | 165 Source<RenderProcessHost>(this), |
| 166 NotificationService::NoDetails()); | 166 NotificationService::NoDetails()); |
| 167 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 167 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 168 RenderProcessHostImpl::UnregisterHost(GetID()); | 168 RenderProcessHostImpl::UnregisterHost(GetID(), this); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 void MockRenderProcessHost::AddPendingView() { | 172 void MockRenderProcessHost::AddPendingView() { |
| 173 } | 173 } |
| 174 | 174 |
| 175 void MockRenderProcessHost::RemovePendingView() { | 175 void MockRenderProcessHost::RemovePendingView() { |
| 176 } | 176 } |
| 177 | 177 |
| 178 void MockRenderProcessHost::SetSuddenTerminationAllowed(bool allowed) { | 178 void MockRenderProcessHost::SetSuddenTerminationAllowed(bool allowed) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 245 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 246 it != processes_.end(); ++it) { | 246 it != processes_.end(); ++it) { |
| 247 if (*it == host) { | 247 if (*it == host) { |
| 248 processes_.weak_erase(it); | 248 processes_.weak_erase(it); |
| 249 break; | 249 break; |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // content | 254 } // content |
| OLD | NEW |