diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-23 03:09:52 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-23 03:09:52 +0000 |
commit | fa8a2b1b050009d67e03cf03a26d7d558afe0ecb (patch) | |
tree | 09108ff8271c1ca005d439213db16a784977175f /chrome/renderer/mock_render_thread.h | |
parent | b6b60c9b2afa70010fe38ed7c753f4c8e37e7131 (diff) | |
download | chromium_src-fa8a2b1b050009d67e03cf03a26d7d558afe0ecb.zip chromium_src-fa8a2b1b050009d67e03cf03a26d7d558afe0ecb.tar.gz chromium_src-fa8a2b1b050009d67e03cf03a26d7d558afe0ecb.tar.bz2 |
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
Diffstat (limited to 'chrome/renderer/mock_render_thread.h')
-rw-r--r-- | chrome/renderer/mock_render_thread.h | 13 |
1 files changed, 13 insertions, 0 deletions
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 <vector> #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<IPC::MessageReplyDeserializer> reply_deserializer_; + + // A mock printer device used for printing tests. + scoped_ptr<MockPrinter> printer_; }; #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |