summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/mock_render_thread.cc
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-16 05:30:54 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-16 05:30:54 +0000
commitda911550f99db64535a175d62f63d467eec12bbc (patch)
treeb4548469fb74726e28cf5408257f3169eddf662a /chrome/renderer/mock_render_thread.cc
parentdafa920a52965183ce936f0837868f6b6f0cbb6c (diff)
downloadchromium_src-da911550f99db64535a175d62f63d467eec12bbc.zip
chromium_src-da911550f99db64535a175d62f63d467eec12bbc.tar.gz
chromium_src-da911550f99db64535a175d62f63d467eec12bbc.tar.bz2
Introduce printing test case (Step 1)
This CL will just show how to actually execute a full print process from start to finish. It will verify that a page has been printed (successfully). In the next steps, we would need to test whether the elements rendered after printing are correct. (how?) And fixed some lint errors. Thanks for hbono and maruel to lead me in the right direction :) Original patch by Mohamed Mansour (see http://codereview.chromium.org/67036/show), r=me,maruel,sverrir. BUG=? Review URL: http://codereview.chromium.org/67202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/mock_render_thread.cc')
-rw-r--r--chrome/renderer/mock_render_thread.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc
index 19fdd48..b133238 100644
--- a/chrome/renderer/mock_render_thread.cc
+++ b/chrome/renderer/mock_render_thread.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -73,6 +73,12 @@ void MockRenderThread::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget);
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension,
OnMsgOpenChannelToExtension);
+#if defined(OS_WIN)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_GetDefaultPrintSettings,
+ OnGetDefaultPrintSettings);
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptedPrint,
+ OnScriptedPrint);
+#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
}
@@ -89,3 +95,22 @@ void MockRenderThread::OnMsgOpenChannelToExtension(
const std::string& extension_id, int* channel_id) {
*channel_id = 0;
}
+
+void MockRenderThread::OnGetDefaultPrintSettings(ViewMsg_Print_Params* params) {
+ memset(params, 0, sizeof(ViewMsg_Print_Params));
+ params->dpi = 72;
+ params->desired_dpi = 72;
+ params->document_cookie = 1;
+ params->printable_size = gfx::Size(500, 500);
+}
+
+void MockRenderThread::OnScriptedPrint(gfx::NativeViewId host_window,
+ int cookie,
+ int expected_pages_count,
+ ViewMsg_PrintPages_Params* settings) {
+ memset(settings, 0, sizeof(ViewMsg_PrintPages_Params));
+ settings->params.dpi = 72;
+ settings->params.document_cookie = 1;
+ settings->params.desired_dpi = 72;
+ settings->params.printable_size = gfx::Size(500, 500);
+}