| 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/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "content/browser/child_process_security_policy_impl.h" | 11 #include "content/browser/child_process_security_policy_impl.h" |
| 12 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 14 #include "content/browser/renderer_host/render_widget_host_impl.h" | 14 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 15 #include "content/common/child_process_host_impl.h" | 15 #include "content/common/child_process_host_impl.h" |
| 16 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/global_request_id.h" | 17 #include "content/public/browser/global_request_id.h" |
| 17 #include "content/public/browser/render_widget_host_iterator.h" | 18 #include "content/public/browser/render_widget_host_iterator.h" |
| 18 #include "content/public/browser/storage_partition.h" | 19 #include "content/public/browser/storage_partition.h" |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) | 23 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) |
| 23 : bad_msg_count_(0), | 24 : bad_msg_count_(0), |
| 24 factory_(NULL), | 25 factory_(NULL), |
| 25 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 26 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 int MockRenderProcessHost::VisibleWidgetCount() const { | 95 int MockRenderProcessHost::VisibleWidgetCount() const { |
| 95 return 1; | 96 return 1; |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool MockRenderProcessHost::IsIsolatedGuest() const { | 99 bool MockRenderProcessHost::IsIsolatedGuest() const { |
| 99 return is_isolated_guest_; | 100 return is_isolated_guest_; |
| 100 } | 101 } |
| 101 | 102 |
| 102 StoragePartition* MockRenderProcessHost::GetStoragePartition() const { | 103 StoragePartition* MockRenderProcessHost::GetStoragePartition() const { |
| 103 return NULL; | 104 return BrowserContext::GetDefaultStoragePartition(browser_context_); |
| 104 } | 105 } |
| 105 | 106 |
| 106 void MockRenderProcessHost::AddWord(const base::string16& word) { | 107 void MockRenderProcessHost::AddWord(const base::string16& word) { |
| 107 } | 108 } |
| 108 | 109 |
| 109 bool MockRenderProcessHost::FastShutdownIfPossible() { | 110 bool MockRenderProcessHost::FastShutdownIfPossible() { |
| 110 // We aren't actually going to do anything, but set |fast_shutdown_started_| | 111 // We aren't actually going to do anything, but set |fast_shutdown_started_| |
| 111 // to true so that tests know we've been called. | 112 // to true so that tests know we've been called. |
| 112 fast_shutdown_started_ = true; | 113 fast_shutdown_started_ = true; |
| 113 return true; | 114 return true; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 293 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 293 it != processes_.end(); ++it) { | 294 it != processes_.end(); ++it) { |
| 294 if (*it == host) { | 295 if (*it == host) { |
| 295 processes_.weak_erase(it); | 296 processes_.weak_erase(it); |
| 296 break; | 297 break; |
| 297 } | 298 } |
| 298 } | 299 } |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // content | 302 } // content |
| OLD | NEW |