| 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/location.h" | 12 #include "base/location.h" |
| 13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/browser/child_process_security_policy_impl.h" | 17 #include "content/browser/child_process_security_policy_impl.h" |
| 18 #include "content/browser/renderer_host/render_process_host_impl.h" | 18 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_view_host_impl.h" | 19 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 20 #include "content/browser/renderer_host/render_widget_host_impl.h" | 20 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 21 #include "content/common/child_process_host_impl.h" | 21 #include "content/common/child_process_host_impl.h" |
| 22 #include "content/common/frame_messages.h" | 22 #include "content/common/frame_messages.h" |
| 23 #include "content/common/renderer.mojom.h" |
| 23 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 24 #include "content/public/browser/global_request_id.h" | 25 #include "content/public/browser/global_request_id.h" |
| 25 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
| 26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/notification_source.h" | 28 #include "content/public/browser/notification_source.h" |
| 28 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
| 29 #include "content/public/browser/render_widget_host_iterator.h" | 30 #include "content/public/browser/render_widget_host_iterator.h" |
| 30 #include "content/public/browser/storage_partition.h" | 31 #include "content/public/browser/storage_partition.h" |
| 32 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 31 | 33 |
| 32 namespace content { | 34 namespace content { |
| 33 | 35 |
| 34 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) | 36 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) |
| 35 : bad_msg_count_(0), | 37 : bad_msg_count_(0), |
| 36 factory_(NULL), | 38 factory_(NULL), |
| 37 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 39 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 38 has_connection_(false), | 40 has_connection_(false), |
| 39 browser_context_(browser_context), | 41 browser_context_(browser_context), |
| 40 prev_routing_id_(0), | 42 prev_routing_id_(0), |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 void MockRenderProcessHost::ForceReleaseWorkerRefCounts() { | 294 void MockRenderProcessHost::ForceReleaseWorkerRefCounts() { |
| 293 worker_ref_count_ = 0; | 295 worker_ref_count_ = 0; |
| 294 } | 296 } |
| 295 | 297 |
| 296 bool MockRenderProcessHost::IsWorkerRefCountDisabled() { | 298 bool MockRenderProcessHost::IsWorkerRefCountDisabled() { |
| 297 return false; | 299 return false; |
| 298 } | 300 } |
| 299 | 301 |
| 300 void MockRenderProcessHost::PurgeAndSuspend() {} | 302 void MockRenderProcessHost::PurgeAndSuspend() {} |
| 301 | 303 |
| 304 mojom::Renderer* MockRenderProcessHost::GetRendererInterface() { |
| 305 if (!renderer_interface_) { |
| 306 renderer_interface_.reset(new mojom::RendererAssociatedPtr); |
| 307 mojo::GetDummyProxyForTesting(renderer_interface_.get()); |
| 308 } |
| 309 return renderer_interface_->get(); |
| 310 } |
| 311 |
| 302 void MockRenderProcessHost::FilterURL(bool empty_allowed, GURL* url) { | 312 void MockRenderProcessHost::FilterURL(bool empty_allowed, GURL* url) { |
| 303 RenderProcessHostImpl::FilterURL(this, empty_allowed, url); | 313 RenderProcessHostImpl::FilterURL(this, empty_allowed, url); |
| 304 } | 314 } |
| 305 | 315 |
| 306 #if defined(ENABLE_WEBRTC) | 316 #if defined(ENABLE_WEBRTC) |
| 307 void MockRenderProcessHost::EnableAudioDebugRecordings( | 317 void MockRenderProcessHost::EnableAudioDebugRecordings( |
| 308 const base::FilePath& file) { | 318 const base::FilePath& file) { |
| 309 } | 319 } |
| 310 | 320 |
| 311 void MockRenderProcessHost::DisableAudioDebugRecordings() {} | 321 void MockRenderProcessHost::DisableAudioDebugRecordings() {} |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 382 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 373 it != processes_.end(); ++it) { | 383 it != processes_.end(); ++it) { |
| 374 if (*it == host) { | 384 if (*it == host) { |
| 375 processes_.weak_erase(it); | 385 processes_.weak_erase(it); |
| 376 break; | 386 break; |
| 377 } | 387 } |
| 378 } | 388 } |
| 379 } | 389 } |
| 380 | 390 |
| 381 } // namespace content | 391 } // namespace content |
| OLD | NEW |