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) { | 29 is_isolated_guest_(false) { |
30 // Child process security operations can't be unit tested unless we add | 30 // Child process security operations can't be unit tested unless we add |
31 // ourselves as an existing child process. | 31 // ourselves as an existing child process. |
32 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 32 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
33 | 33 |
34 RenderProcessHostImpl::RegisterHost(GetID(), this); | 34 RenderProcessHostImpl::RegisterHost(GetID(), this); |
35 } | 35 } |
36 | 36 |
37 MockRenderProcessHost::~MockRenderProcessHost() { | 37 MockRenderProcessHost::~MockRenderProcessHost() { |
38 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); | 38 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(GetID()); |
39 if (factory_) | 39 if (factory_) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void MockRenderProcessHost::WidgetRestored() { | 94 void MockRenderProcessHost::WidgetRestored() { |
95 } | 95 } |
96 | 96 |
97 void MockRenderProcessHost::WidgetHidden() { | 97 void MockRenderProcessHost::WidgetHidden() { |
98 } | 98 } |
99 | 99 |
100 int MockRenderProcessHost::VisibleWidgetCount() const { | 100 int MockRenderProcessHost::VisibleWidgetCount() const { |
101 return 1; | 101 return 1; |
102 } | 102 } |
103 | 103 |
104 bool MockRenderProcessHost::IsGuest() const { | 104 bool MockRenderProcessHost::IsIsolatedGuest() const { |
105 return is_guest_; | 105 return is_isolated_guest_; |
106 } | 106 } |
107 | 107 |
108 StoragePartition* MockRenderProcessHost::GetStoragePartition() const { | 108 StoragePartition* MockRenderProcessHost::GetStoragePartition() const { |
109 return NULL; | 109 return NULL; |
110 } | 110 } |
111 | 111 |
112 void MockRenderProcessHost::AddWord(const base::string16& word) { | 112 void MockRenderProcessHost::AddWord(const base::string16& word) { |
113 } | 113 } |
114 | 114 |
115 bool MockRenderProcessHost::FastShutdownIfPossible() { | 115 bool MockRenderProcessHost::FastShutdownIfPossible() { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 278 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
279 it != processes_.end(); ++it) { | 279 it != processes_.end(); ++it) { |
280 if (*it == host) { | 280 if (*it == host) { |
281 processes_.weak_erase(it); | 281 processes_.weak_erase(it); |
282 break; | 282 break; |
283 } | 283 } |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 } // content | 287 } // content |
OLD | NEW |