summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 20:01:07 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-24 20:01:07 +0000
commit15d890b1a9a05e7d1733ff3cefd68a13d07bfe2b (patch)
tree9a06d1d3332349acbd6581f40cf84f96413825bb /chrome/test
parent1a999b9b66ba047ddd427b704fa04d5be39f00e0 (diff)
downloadchromium_src-15d890b1a9a05e7d1733ff3cefd68a13d07bfe2b.zip
chromium_src-15d890b1a9a05e7d1733ff3cefd68a13d07bfe2b.tar.gz
chromium_src-15d890b1a9a05e7d1733ff3cefd68a13d07bfe2b.tar.bz2
Port some more RenderViewTests to Linux.
Focus on printing tests. The ones I didn't port may not be worth the effort if we are going to change Linux printing soon. BUG=none TEST=tests pass Review URL: http://codereview.chromium.org/2066016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48072 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/render_view_test.cc34
-rw-r--r--chrome/test/render_view_test.h7
2 files changed, 41 insertions, 0 deletions
diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc
index d4eb90f..07a5e05 100644
--- a/chrome/test/render_view_test.cc
+++ b/chrome/test/render_view_test.cc
@@ -224,3 +224,37 @@ void RenderViewTest::SendNativeKeyEvent(
sizeof(WebKit::WebKeyboardEvent));
view_->OnHandleInputEvent(*input_message);
}
+
+void RenderViewTest::VerifyPageCount(int count) {
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ const IPC::Message* page_cnt_msg =
+ render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_DidGetPrintedPagesCount::ID);
+ ASSERT_TRUE(page_cnt_msg);
+ ViewHostMsg_DidGetPrintedPagesCount::Param post_page_count_param;
+ ViewHostMsg_DidGetPrintedPagesCount::Read(page_cnt_msg,
+ &post_page_count_param);
+ EXPECT_EQ(count, post_page_count_param.b);
+#elif defined(OS_LINUX)
+ // The DidGetPrintedPagesCount message isn't sent on Linux. Right now we
+ // always print all pages, and there are checks to that effect built into
+ // the print code.
+#endif
+}
+
+void RenderViewTest::VerifyPagesPrinted() {
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ const IPC::Message* did_print_msg =
+ render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_DidPrintPage::ID);
+ ASSERT_TRUE(did_print_msg);
+ ViewHostMsg_DidPrintPage::Param post_did_print_page_param;
+ ViewHostMsg_DidPrintPage::Read(did_print_msg, &post_did_print_page_param);
+ EXPECT_EQ(0, post_did_print_page_param.a.page_number);
+#elif defined(OS_LINUX)
+ const IPC::Message* did_print_msg =
+ render_thread_.sink().GetUniqueMessageMatching(
+ ViewHostMsg_TempFileForPrintingWritten::ID);
+ ASSERT_TRUE(did_print_msg);
+#endif
+}
diff --git a/chrome/test/render_view_test.h b/chrome/test/render_view_test.h
index 4834d9a..af6059e 100644
--- a/chrome/test/render_view_test.h
+++ b/chrome/test/render_view_test.h
@@ -50,6 +50,13 @@ class RenderViewTest : public testing::Test {
// Sends one native key event over IPC.
void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event);
+ // The renderer should be done calculating the number of rendered pages
+ // according to the specified settings defined in the mock render thread.
+ // Verify the page count is correct.
+ void VerifyPageCount(int count);
+ // Verify the rendered "printed page".
+ void VerifyPagesPrinted();
+
// testing::Test
virtual void SetUp();