summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view_unittest.cc
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 03:56:51 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 03:56:51 +0000
commit507b33eab2acbb4e360b5b6eb9f2e666079d0e3b (patch)
tree6fd3dd864e9da3e68efc7ded0dbaf96b597fcd3c /chrome/renderer/render_view_unittest.cc
parent529338471fec2ab9b07bac9b07e3477b20e0ae28 (diff)
downloadchromium_src-507b33eab2acbb4e360b5b6eb9f2e666079d0e3b.zip
chromium_src-507b33eab2acbb4e360b5b6eb9f2e666079d0e3b.tar.gz
chromium_src-507b33eab2acbb4e360b5b6eb9f2e666079d0e3b.tar.bz2
Fix cmd-up/cmd-down.
The approach is to special-case moveToBeginningOfDocument and moveToEndOfDocument in WebFrameImpl::executeCommand(). With this (and the cocoa keyboard bindings patch being landed), the special-case code in WebViewImpl::ScrollViewWithKeyboard() can be removed. Also add a test for cmd-up/down. Change chrome.gyp so that it supports osx-only unit tests (_unittest_mac.mm). Move OnPrintPageAsBitmap to the other printing tests. BUG=22585 TEST=Go to a page with both text box and scrollbar (e.g. http://en.wikipedia.org ). Pressing cmd-down should scroll to end of page, cmd-up back to start. Clicking the text box and trying some emacs shortcuts should work (ctrl-a jumps to start of line, cmd-h acts as backspace, etc). Review URL: http://codereview.chromium.org/254002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view_unittest.cc')
-rw-r--r--chrome/renderer/render_view_unittest.cc84
1 files changed, 42 insertions, 42 deletions
diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc
index 5e10179..3119996 100644
--- a/chrome/renderer/render_view_unittest.cc
+++ b/chrome/renderer/render_view_unittest.cc
@@ -496,6 +496,48 @@ TEST_F(RenderViewTest, PrintLayoutTest) {
#endif
}
+// Print page as bitmap test.
+TEST_F(RenderViewTest, OnPrintPageAsBitmap) {
+#if defined(OS_WIN)
+ // Lets simulate a print pages with Hello world.
+ LoadHTML("<body><p>Hello world!</p></body>");
+
+ // Grab the printer settings from the printer.
+ ViewMsg_Print_Params print_settings;
+ MockPrinter* printer(render_thread_.printer());
+ printer->GetDefaultPrintSettings(&print_settings);
+ ViewMsg_PrintPage_Params page_params = ViewMsg_PrintPage_Params();
+ page_params.params = print_settings;
+ page_params.page_number = 0;
+
+ // Fetch the image data from the web frame.
+ std::vector<unsigned char> data;
+ view_->print_helper()->PrintPageAsJPEG(page_params,
+ view_->webview()->GetMainFrame(),
+ 1.0f,
+ &data);
+ std::vector<unsigned char> decoded;
+ int w, h;
+ EXPECT_TRUE(JPEGCodec::Decode(&data[0], data.size(), JPEGCodec::FORMAT_RGBA,
+ &decoded, &w, &h));
+
+ // Check if its not 100% white.
+ bool is_white = true;
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++) {
+ unsigned char* px = &decoded[(y * w + x) * 4];
+ if (px[0] != 0xFF && px[1] != 0xFF && px[2] != 0xFF) {
+ is_white = false;
+ break;
+ }
+ }
+ }
+ ASSERT_TRUE(!is_white);
+#else
+ NOTIMPLEMENTED();
+#endif
+}
+
// Test that we can receive correct DOM events when we send input events
// through the RenderWidget::OnHandleInputEvent() function.
TEST_F(RenderViewTest, OnHandleKeyboardEvent) {
@@ -868,45 +910,3 @@ TEST_F(RenderViewTest, DidFailProvisionalLoadWithErrorForCancellation) {
// Frame should stay in view-source mode.
EXPECT_TRUE(web_frame->isViewSourceModeEnabled());
}
-
-// Print page as bitmap test.
-TEST_F(RenderViewTest, OnPrintPageAsBitmap) {
-#if defined(OS_WIN)
- // Lets simulate a print pages with Hello world.
- LoadHTML("<body><p>Hello world!</p></body>");
-
- // Grab the printer settings from the printer.
- ViewMsg_Print_Params print_settings;
- MockPrinter* printer(render_thread_.printer());
- printer->GetDefaultPrintSettings(&print_settings);
- ViewMsg_PrintPage_Params page_params = ViewMsg_PrintPage_Params();
- page_params.params = print_settings;
- page_params.page_number = 0;
-
- // Fetch the image data from the web frame.
- std::vector<unsigned char> data;
- view_->print_helper()->PrintPageAsJPEG(page_params,
- view_->webview()->GetMainFrame(),
- 1.0f,
- &data);
- std::vector<unsigned char> decoded;
- int w, h;
- EXPECT_TRUE(JPEGCodec::Decode(&data[0], data.size(), JPEGCodec::FORMAT_RGBA,
- &decoded, &w, &h));
-
- // Check if its not 100% white.
- bool is_white = true;
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- unsigned char* px = &decoded[(y * w + x) * 4];
- if (px[0] != 0xFF && px[1] != 0xFF && px[2] != 0xFF) {
- is_white = false;
- break;
- }
- }
- }
- ASSERT_TRUE(!is_white);
-#else
- NOTIMPLEMENTED();
-#endif
-}