OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/mock_render_thread.h" | 5 #include "chrome/renderer/mock_render_thread.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 11 #include "chrome/common/extensions/extension_messages.h" |
11 #include "chrome/common/print_messages.h" | 12 #include "chrome/common/print_messages.h" |
12 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
15 #include "ipc/ipc_message_utils.h" | 16 #include "ipc/ipc_message_utils.h" |
16 #include "ipc/ipc_sync_message.h" | 17 #include "ipc/ipc_sync_message.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 MockRenderThread::MockRenderThread() | 20 MockRenderThread::MockRenderThread() |
20 : routing_id_(0), | 21 : routing_id_(0), |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 98 |
98 bool MockRenderThread::OnMessageReceived(const IPC::Message& msg) { | 99 bool MockRenderThread::OnMessageReceived(const IPC::Message& msg) { |
99 // Save the message in the sink. | 100 // Save the message in the sink. |
100 sink_.OnMessageReceived(msg); | 101 sink_.OnMessageReceived(msg); |
101 | 102 |
102 // Some messages we do special handling. | 103 // Some messages we do special handling. |
103 bool handled = true; | 104 bool handled = true; |
104 bool msg_is_ok = true; | 105 bool msg_is_ok = true; |
105 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok) | 106 IPC_BEGIN_MESSAGE_MAP_EX(MockRenderThread, msg, msg_is_ok) |
106 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) | 107 IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) |
107 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, | 108 IPC_MESSAGE_HANDLER(ExtensionHostMsg_OpenChannelToExtension, |
108 OnMsgOpenChannelToExtension) | 109 OnMsgOpenChannelToExtension) |
109 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, | 110 IPC_MESSAGE_HANDLER(PrintHostMsg_GetDefaultPrintSettings, |
110 OnGetDefaultPrintSettings) | 111 OnGetDefaultPrintSettings) |
111 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, | 112 IPC_MESSAGE_HANDLER(PrintHostMsg_ScriptedPrint, |
112 OnScriptedPrint) | 113 OnScriptedPrint) |
113 #if defined(OS_WIN) || defined(OS_MACOSX) | 114 #if defined(OS_WIN) || defined(OS_MACOSX) |
114 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, | 115 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, |
115 OnDidGetPrintedPagesCount) | 116 OnDidGetPrintedPagesCount) |
116 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) | 117 IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) |
117 #endif | 118 #endif |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 212 |
212 void MockRenderThread::OnDidPrintPage( | 213 void MockRenderThread::OnDidPrintPage( |
213 const PrintHostMsg_DidPrintPage_Params& params) { | 214 const PrintHostMsg_DidPrintPage_Params& params) { |
214 if (printer_.get()) | 215 if (printer_.get()) |
215 printer_->PrintPage(params); | 216 printer_->PrintPage(params); |
216 } | 217 } |
217 | 218 |
218 void MockRenderThread::set_print_dialog_user_response(bool response) { | 219 void MockRenderThread::set_print_dialog_user_response(bool response) { |
219 print_dialog_user_response_ = response; | 220 print_dialog_user_response_ = response; |
220 } | 221 } |
OLD | NEW |