summaryrefslogtreecommitdiffstats
path: root/chrome/test/render_view_test.h
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-11 04:41:21 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-11 04:41:21 +0000
commit8b048323819876b75e3875cd1de5ef01f1f54375 (patch)
tree1397552dd2d5c6d1461d253523e7e0118eb8b520 /chrome/test/render_view_test.h
parentda4f93efcfa81849826a188b39c92fb3b94a87f6 (diff)
downloadchromium_src-8b048323819876b75e3875cd1de5ef01f1f54375.zip
chromium_src-8b048323819876b75e3875cd1de5ef01f1f54375.tar.gz
chromium_src-8b048323819876b75e3875cd1de5ef01f1f54375.tar.bz2
Implements keyboard events for RenderViewTest.This change implements a function RenderViewTest::SendKeyEvent() that sends a keyboard event to a RenderView object.To emulate not only US keyboards but also non-US keyboards, this change adds a new class "MockKeyboard", which implements a mapping function from a triple <keyboard type, key code, modifiers> to a Unicode character so that engineers can write RenderViewTest cases without taking care of keyboard types.As samples for this new function, I updated my test RenderViewTest.OnHandleKeyboardEvent and added another test RenderViewTest.InsertCharacters.I wish this class help engineers write more RenderViewTest cases.
Review URL: http://codereview.chromium.org/92122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/render_view_test.h')
-rw-r--r--chrome/test/render_view_test.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/test/render_view_test.h b/chrome/test/render_view_test.h
index abda898..a399c7b 100644
--- a/chrome/test/render_view_test.h
+++ b/chrome/test/render_view_test.h
@@ -5,7 +5,10 @@
#ifndef CHROME_TEST_RENDER_VIEW_TEST_H_
#define CHROME_TEST_RENDER_VIEW_TEST_H_
+#include <string>
+
#include "base/scoped_ptr.h"
+#include "chrome/renderer/mock_keyboard.h"
#include "chrome/renderer/mock_render_process.h"
#include "chrome/renderer/mock_render_thread.h"
#include "chrome/renderer/render_view.h"
@@ -32,6 +35,12 @@ class RenderViewTest : public testing::Test {
// Loads the given HTML into the main frame as a data: URL.
void LoadHTML(const char* html);
+ // Sends IPC messages that emulates a key-press event.
+ int SendKeyEvent(MockKeyboard::Layout layout,
+ int key_code,
+ MockKeyboard::Modifiers key_modifiers,
+ std::wstring* output);
+
// testing::Test
virtual void SetUp();
@@ -42,6 +51,7 @@ class RenderViewTest : public testing::Test {
scoped_ptr<MockProcess> mock_process_;
scoped_refptr<RenderView> view_;
RendererWebKitClientImpl webkitclient_;
+ scoped_ptr<MockKeyboard> mock_keyboard_;
};
#endif // CHROME_TEST_RENDER_VIEW_TEST_H_