diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 03:56:51 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 03:56:51 +0000 |
commit | 507b33eab2acbb4e360b5b6eb9f2e666079d0e3b (patch) | |
tree | 6fd3dd864e9da3e68efc7ded0dbaf96b597fcd3c /chrome/test/render_view_test.cc | |
parent | 529338471fec2ab9b07bac9b07e3477b20e0ae28 (diff) | |
download | chromium_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/test/render_view_test.cc')
-rw-r--r-- | chrome/test/render_view_test.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 2f12836..e0321c7 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -158,22 +158,13 @@ int RenderViewTest::SendKeyEvent(MockKeyboard::Layout layout, // WM_KEYDOWN and WM_KEYUP sends virtual-key codes. On the other hand, // WM_CHAR sends a composed Unicode character. NativeWebKeyboardEvent keydown_event(NULL, WM_KEYDOWN, key_code, 0); - scoped_ptr<IPC::Message> keydown_message(new ViewMsg_HandleInputEvent(0)); - keydown_message->WriteData(reinterpret_cast<const char*>(&keydown_event), - sizeof(WebKit::WebKeyboardEvent)); - view_->OnHandleInputEvent(*keydown_message); + SendNativeKeyEvent(keydown_event); NativeWebKeyboardEvent char_event(NULL, WM_CHAR, (*output)[0], 0); - scoped_ptr<IPC::Message> char_message(new ViewMsg_HandleInputEvent(0)); - char_message->WriteData(reinterpret_cast<const char*>(&char_event), - sizeof(WebKit::WebKeyboardEvent)); - view_->OnHandleInputEvent(*char_message); + SendNativeKeyEvent(char_event); NativeWebKeyboardEvent keyup_event(NULL, WM_KEYUP, key_code, 0); - scoped_ptr<IPC::Message> keyup_message(new ViewMsg_HandleInputEvent(0)); - keyup_message->WriteData(reinterpret_cast<const char*>(&keyup_event), - sizeof(WebKit::WebKeyboardEvent)); - view_->OnHandleInputEvent(*keyup_message); + SendNativeKeyEvent(keyup_event); return length; #else @@ -181,3 +172,11 @@ int RenderViewTest::SendKeyEvent(MockKeyboard::Layout layout, return L'\0'; #endif } + +void RenderViewTest::SendNativeKeyEvent( + const NativeWebKeyboardEvent& key_event) { + scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); + input_message->WriteData(reinterpret_cast<const char*>(&key_event), + sizeof(WebKit::WebKeyboardEvent)); + view_->OnHandleInputEvent(*input_message); +} |