| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "content/browser/child_process_security_policy_impl.h" | 15 #include "content/browser/child_process_security_policy_impl.h" |
| 16 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 16 #include "content/browser/renderer_host/render_process_host_impl.h" | 17 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 17 #include "content/browser/renderer_host/render_view_host_impl.h" | 18 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 19 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 19 #include "content/common/child_process_host_impl.h" | 20 #include "content/common/child_process_host_impl.h" |
| 20 #include "content/common/frame_messages.h" | 21 #include "content/common/frame_messages.h" |
| 21 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/global_request_id.h" | 23 #include "content/public/browser/global_request_id.h" |
| 23 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
| 24 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 337 |
| 337 bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { | 338 bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| 338 IPC::Listener* listener = listeners_.Lookup(msg.routing_id()); | 339 IPC::Listener* listener = listeners_.Lookup(msg.routing_id()); |
| 339 if (listener) | 340 if (listener) |
| 340 return listener->OnMessageReceived(msg); | 341 return listener->OnMessageReceived(msg); |
| 341 return false; | 342 return false; |
| 342 } | 343 } |
| 343 | 344 |
| 344 void MockRenderProcessHost::OnChannelConnected(int32_t peer_pid) {} | 345 void MockRenderProcessHost::OnChannelConnected(int32_t peer_pid) {} |
| 345 | 346 |
| 347 scoped_refptr<AudioRendererHost> MockRenderProcessHost::audio_renderer_host() |
| 348 const { |
| 349 return scoped_refptr<AudioRendererHost>(nullptr); |
| 350 }; |
| 351 |
| 346 MockRenderProcessHostFactory::MockRenderProcessHostFactory() {} | 352 MockRenderProcessHostFactory::MockRenderProcessHostFactory() {} |
| 347 | 353 |
| 348 MockRenderProcessHostFactory::~MockRenderProcessHostFactory() { | 354 MockRenderProcessHostFactory::~MockRenderProcessHostFactory() { |
| 349 // Detach this object from MockRenderProcesses to prevent STLDeleteElements() | 355 // Detach this object from MockRenderProcesses to prevent STLDeleteElements() |
| 350 // from calling MockRenderProcessHostFactory::Remove(). | 356 // from calling MockRenderProcessHostFactory::Remove(). |
| 351 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 357 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 352 it != processes_.end(); ++it) { | 358 it != processes_.end(); ++it) { |
| 353 (*it)->SetFactory(NULL); | 359 (*it)->SetFactory(NULL); |
| 354 } | 360 } |
| 355 } | 361 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 369 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 375 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 370 it != processes_.end(); ++it) { | 376 it != processes_.end(); ++it) { |
| 371 if (*it == host) { | 377 if (*it == host) { |
| 372 processes_.weak_erase(it); | 378 processes_.weak_erase(it); |
| 373 break; | 379 break; |
| 374 } | 380 } |
| 375 } | 381 } |
| 376 } | 382 } |
| 377 | 383 |
| 378 } // namespace content | 384 } // namespace content |
| OLD | NEW |