Chromium Code Reviews| 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" |
| 11 #include "content/browser/renderer_host/render_process_host_impl.h" | 11 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 12 #include "content/browser/renderer_host/render_view_host_impl.h" | 12 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_impl.h" | 13 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 14 #include "content/common/child_process_host_impl.h" | 14 #include "content/common/child_process_host_impl.h" |
| 15 #include "content/public/browser/global_request_id.h" | 15 #include "content/public/browser/global_request_id.h" |
| 16 #include "content/public/browser/render_widget_host_iterator.h" | 16 #include "content/public/browser/render_widget_host_iterator.h" |
| 17 #include "content/public/browser/storage_partition.h" | 17 #include "content/public/browser/storage_partition.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) | 21 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) |
| 22 : bad_msg_count_(0), | 22 : bad_msg_count_(0), |
| 23 factory_(NULL), | 23 factory_(NULL), |
| 24 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 24 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 25 browser_context_(browser_context), | 25 browser_context_(browser_context), |
| 26 prev_routing_id_(0), | 26 prev_routing_id_(0), |
| 27 fast_shutdown_started_(false), | 27 fast_shutdown_started_(false), |
| 28 deletion_callback_called_(false), | 28 deletion_callback_called_(false) { |
| 29 is_guest_(false) { | |
| 30 // Child process security operations can't be unit tested unless we add | 29 // Child process security operations can't be unit tested unless we add |
| 31 // ourselves as an existing child process. | 30 // ourselves as an existing child process. |
| 32 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 31 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
| 33 | 32 |
| 34 RenderProcessHostImpl::RegisterHost(GetID(), this); | 33 RenderProcessHostImpl::RegisterHost(GetID(), this); |
| 35 } | 34 } |
| 36 | 35 |
| 37 MockRenderProcessHost::~MockRenderProcessHost() { | 36 MockRenderProcessHost::~MockRenderProcessHost() { |
| 38 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); | 37 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); |
| 39 if (factory_) | 38 if (factory_) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 void MockRenderProcessHost::WidgetRestored() { | 93 void MockRenderProcessHost::WidgetRestored() { |
| 95 } | 94 } |
| 96 | 95 |
| 97 void MockRenderProcessHost::WidgetHidden() { | 96 void MockRenderProcessHost::WidgetHidden() { |
| 98 } | 97 } |
| 99 | 98 |
| 100 int MockRenderProcessHost::VisibleWidgetCount() const { | 99 int MockRenderProcessHost::VisibleWidgetCount() const { |
| 101 return 1; | 100 return 1; |
| 102 } | 101 } |
| 103 | 102 |
| 104 bool MockRenderProcessHost::IsGuest() const { | 103 bool MockRenderProcessHost::IsIsolatedGuest() const { |
| 105 return is_guest_; | 104 return false; |
|
nasko
2014/05/28 16:29:13
Is it no longer true that content/ on its own can
fsamuel
2014/05/28 16:37:01
Yes, it is true. BrowserPlugin is now inert withou
| |
| 106 } | 105 } |
| 107 | 106 |
| 108 StoragePartition* MockRenderProcessHost::GetStoragePartition() const { | 107 StoragePartition* MockRenderProcessHost::GetStoragePartition() const { |
| 109 return NULL; | 108 return NULL; |
| 110 } | 109 } |
| 111 | 110 |
| 112 void MockRenderProcessHost::AddWord(const base::string16& word) { | 111 void MockRenderProcessHost::AddWord(const base::string16& word) { |
| 113 } | 112 } |
| 114 | 113 |
| 115 bool MockRenderProcessHost::FastShutdownIfPossible() { | 114 bool MockRenderProcessHost::FastShutdownIfPossible() { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 277 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 279 it != processes_.end(); ++it) { | 278 it != processes_.end(); ++it) { |
| 280 if (*it == host) { | 279 if (*it == host) { |
| 281 processes_.weak_erase(it); | 280 processes_.weak_erase(it); |
| 282 break; | 281 break; |
| 283 } | 282 } |
| 284 } | 283 } |
| 285 } | 284 } |
| 286 | 285 |
| 287 } // content | 286 } // content |
| OLD | NEW |