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/render_process_host_impl.h" | 16 #include "content/browser/renderer_host/render_process_host_impl.h" |
17 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 18 #include "content/browser/renderer_host/render_widget_host_impl.h" |
19 #include "content/common/child_process_host_impl.h" | 19 #include "content/common/child_process_host_impl.h" |
20 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
21 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/browser_message_filter.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" |
26 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/render_widget_host_iterator.h" | 28 #include "content/public/browser/render_widget_host_iterator.h" |
28 #include "content/public/browser/storage_partition.h" | 29 #include "content/public/browser/storage_partition.h" |
| 30 #include "ipc/message_filter.h" |
29 | 31 |
30 #if defined(ENABLE_BROWSER_CDMS) | 32 #if defined(ENABLE_BROWSER_CDMS) |
31 #include "media/base/media_keys.h" | 33 #include "media/base/media_keys.h" |
32 #endif | 34 #endif |
33 | 35 |
34 namespace content { | 36 namespace content { |
35 | 37 |
36 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) | 38 MockRenderProcessHost::MockRenderProcessHost(BrowserContext* browser_context) |
37 : bad_msg_count_(0), | 39 : bad_msg_count_(0), |
38 factory_(NULL), | 40 factory_(NULL), |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 StoragePartition* partition) const { | 239 StoragePartition* partition) const { |
238 // Mock RPHs only have one partition. | 240 // Mock RPHs only have one partition. |
239 return true; | 241 return true; |
240 } | 242 } |
241 | 243 |
242 IPC::ChannelProxy* MockRenderProcessHost::GetChannel() { | 244 IPC::ChannelProxy* MockRenderProcessHost::GetChannel() { |
243 return NULL; | 245 return NULL; |
244 } | 246 } |
245 | 247 |
246 void MockRenderProcessHost::AddFilter(BrowserMessageFilter* filter) { | 248 void MockRenderProcessHost::AddFilter(BrowserMessageFilter* filter) { |
| 249 make_scoped_refptr(filter->GetFilter())->OnFilterAdded(&sink_); |
247 } | 250 } |
248 | 251 |
249 bool MockRenderProcessHost::FastShutdownForPageCount(size_t count) { | 252 bool MockRenderProcessHost::FastShutdownForPageCount(size_t count) { |
250 if (GetActiveViewCount() == count) | 253 if (GetActiveViewCount() == count) |
251 return FastShutdownIfPossible(); | 254 return FastShutdownIfPossible(); |
252 return false; | 255 return false; |
253 } | 256 } |
254 | 257 |
255 base::TimeDelta MockRenderProcessHost::GetChildProcessIdleTime() const { | 258 base::TimeDelta MockRenderProcessHost::GetChildProcessIdleTime() const { |
256 return base::TimeDelta::FromMilliseconds(0); | 259 return base::TimeDelta::FromMilliseconds(0); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 374 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
372 it != processes_.end(); ++it) { | 375 it != processes_.end(); ++it) { |
373 if (*it == host) { | 376 if (*it == host) { |
374 processes_.weak_erase(it); | 377 processes_.weak_erase(it); |
375 break; | 378 break; |
376 } | 379 } |
377 } | 380 } |
378 } | 381 } |
379 | 382 |
380 } // namespace content | 383 } // namespace content |
OLD | NEW |