From fa8a2b1b050009d67e03cf03a26d7d558afe0ecb Mon Sep 17 00:00:00 2001 From: "hbono@chromium.org" Date: Sat, 23 May 2009 03:09:52 +0000 Subject: Adds a RenderViewTest.PrintLayoutTest. This change adds a new test 'RenderViewTest.PrintLayoutTest', which prints an HTML page and verify its output. To process a print job and verify its output, this change adds a pseudo-printer device "MockPrinter" into the MockRenderThread object. This MockPrinter object receives print-related IPC messages, process print jobs, and store the MD5 checksum of the output data. The current RenderViewTest.PrintLayoutTest retrieves the MD5 checksum values and just compare them with expected values. Nevertheless, please feel free to give me your ideas to improve this test. Finally, this change is inspired by PrintingLayoutTextTests (created by maruel) and a RenderViewTest.OnPrintPages (created by Mohamed Mansour). I would like to express my best gratitude to them. BUG=none TEST=none Review URL: http://codereview.chromium.org/100255 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16834 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/mock_render_thread.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'chrome/renderer/mock_render_thread.h') diff --git a/chrome/renderer/mock_render_thread.h b/chrome/renderer/mock_render_thread.h index e4f2403..ebca0df 100644 --- a/chrome/renderer/mock_render_thread.h +++ b/chrome/renderer/mock_render_thread.h @@ -9,6 +9,7 @@ #include #include "chrome/common/ipc_test_sink.h" +#include "chrome/renderer/mock_printer.h" #include "chrome/renderer/render_thread.h" struct ViewMsg_Print_Params; @@ -64,6 +65,9 @@ class MockRenderThread : public RenderThreadBase { // state. void SendCloseMessage(); + // Returns the pseudo-printer instance. + const MockPrinter* printer() const { return printer_.get(); } + private: // This function operates as a regular IPC listener. void OnMessageReceived(const IPC::Message& msg); @@ -78,6 +82,9 @@ class MockRenderThread : public RenderThreadBase { const std::string& extension_id, int* channel_id); + void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, + base::SharedMemoryHandle* browser_handle); + // The RenderView expects default print settings. void OnGetDefaultPrintSettings(ViewMsg_Print_Params* setting); @@ -87,6 +94,9 @@ class MockRenderThread : public RenderThreadBase { int expected_pages_count, ViewMsg_PrintPages_Params* settings); + void OnDidGetPrintedPagesCount(int cookie, int number_pages); + void OnDidPrintPage(const ViewHostMsg_DidPrintPage_Params& params); + IPC::TestSink sink_; // Routing id what will be assigned to the Widget. @@ -101,6 +111,9 @@ class MockRenderThread : public RenderThreadBase { // The last known good deserializer for sync messages. scoped_ptr reply_deserializer_; + + // A mock printer device used for printing tests. + scoped_ptr printer_; }; #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ -- cgit v1.1