OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/mock_render_process_host.h" | 5 #include "chrome/browser/renderer_host/mock_render_process_host.h" |
6 | 6 |
| 7 #include "chrome/common/transport_dib.h" |
| 8 |
7 MockRenderProcessHost::MockRenderProcessHost(Profile* profile) | 9 MockRenderProcessHost::MockRenderProcessHost(Profile* profile) |
8 : RenderProcessHost(profile) { | 10 : RenderProcessHost(profile) { |
9 } | 11 } |
10 | 12 |
11 MockRenderProcessHost::~MockRenderProcessHost() { | 13 MockRenderProcessHost::~MockRenderProcessHost() { |
12 } | 14 } |
13 | 15 |
14 bool MockRenderProcessHost::Init() { | 16 bool MockRenderProcessHost::Init() { |
15 return true; | 17 return true; |
16 } | 18 } |
(...skipping 26 matching lines...) Expand all Loading... |
43 void MockRenderProcessHost::WidgetHidden() { | 45 void MockRenderProcessHost::WidgetHidden() { |
44 } | 46 } |
45 | 47 |
46 void MockRenderProcessHost::AddWord(const std::wstring& word) { | 48 void MockRenderProcessHost::AddWord(const std::wstring& word) { |
47 } | 49 } |
48 | 50 |
49 bool MockRenderProcessHost::FastShutdownIfPossible() { | 51 bool MockRenderProcessHost::FastShutdownIfPossible() { |
50 return false; | 52 return false; |
51 } | 53 } |
52 | 54 |
| 55 TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) { |
| 56 #if defined(OS_WIN) |
| 57 return TransportDIB::Map(dib_id.handle); |
| 58 #elif defined(OS_MACOSX) |
| 59 // On Mac, TransportDIBs are always created in the browser, so we cannot map |
| 60 // one from a dib_id. |
| 61 return TransportDIB::Create(100 * 100 * 4, 0); |
| 62 #elif defined(OS_LINUX) |
| 63 return TransportDIB::Map(dib_id); |
| 64 #endif |
| 65 } |
| 66 |
53 bool MockRenderProcessHost::Send(IPC::Message* msg) { | 67 bool MockRenderProcessHost::Send(IPC::Message* msg) { |
54 // Save the message in the sink. | 68 // Save the message in the sink. |
55 sink_.OnMessageReceived(*msg); | 69 sink_.OnMessageReceived(*msg); |
56 delete msg; | 70 delete msg; |
57 return true; | 71 return true; |
58 } | 72 } |
59 | 73 |
60 void MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { | 74 void MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { |
61 } | 75 } |
62 | 76 |
63 void MockRenderProcessHost::OnChannelConnected(int32 peer_pid) { | 77 void MockRenderProcessHost::OnChannelConnected(int32 peer_pid) { |
64 } | 78 } |
OLD | NEW |