summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/simulate_input.h
diff options
context:
space:
mode:
authoramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 18:57:00 +0000
committeramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-09 18:57:00 +0000
commit2d9ebb01b983db2a3cd7514c658e54a3cb76bc5e (patch)
treef3d2db524183ee64a69f68ef7c55fa88b2e8cbc8 /chrome_frame/test/simulate_input.h
parent89f72b3241a342e39e678e4ff632c4b2a1d54b7a (diff)
downloadchromium_src-2d9ebb01b983db2a3cd7514c658e54a3cb76bc5e.zip
chromium_src-2d9ebb01b983db2a3cd7514c658e54a3cb76bc5e.tar.gz
chromium_src-2d9ebb01b983db2a3cd7514c658e54a3cb76bc5e.tar.bz2
Chrome Frame tests for keyboard accelerators
Added tests for commonly used accelerator keys Ctrl+N - New window Ctrl+W - Close Window Ctrl+R - Reload page Also added test for saving current web page using: Alt-F, A BUG=34675 TEST=new tests added Review URL: http://codereview.chromium.org/689002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/simulate_input.h')
-rw-r--r--chrome_frame/test/simulate_input.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/chrome_frame/test/simulate_input.h b/chrome_frame/test/simulate_input.h
index e739e8f..135c310 100644
--- a/chrome_frame/test/simulate_input.h
+++ b/chrome_frame/test/simulate_input.h
@@ -12,6 +12,13 @@
namespace simulate_input {
+enum Modifier {
+ NONE,
+ SHIFT = 1,
+ CONTROL = 2,
+ ALT = 4
+};
+
// Bring a window into foreground to receive user input.
// Note that this may not work on
bool ForceSetForegroundWindow(HWND window);
@@ -27,33 +34,26 @@ void SetKeyboardFocusToWindow(HWND window);
// Sends a keystroke to the currently active application with optional
// modifiers set.
-void SendMnemonic(WORD mnemonic_char, bool shift_pressed, bool control_pressed,
- bool alt_pressed, bool extended, bool unicode);
+void SendMnemonic(WORD mnemonic_char, Modifier modifiers, bool extended,
+ bool unicode);
// Sends a mouse click to the window passed in.
enum MouseButton { LEFT, RIGHT, MIDDLE, X };
void SendMouseClick(HWND window, int x, int y, MouseButton button);
-// Translates a single char to a virtual key and calls SendVirtualKey.
-void SendScanCode(short scan_code, bool shift, bool control, bool alt);
-void SendChar(char c, bool control, bool alt);
-void SendChar(wchar_t c, bool control, bool alt);
+// Translates a single char to a virtual key.
+void SendScanCode(short scan_code, Modifier modifiers);
+void SendCharA(char c, Modifier modifiers);
+void SendCharW(wchar_t c, Modifier modifiers);
// Sends extended keystroke to the currently active application with optional
// modifiers set.
-void SendExtendedKey(WORD key, bool shift, bool control, bool alt);
+void SendExtendedKey(WORD key, Modifier modifiers);
// Iterates through all the characters in the string and simulates
// keyboard input. The input goes to the currently active application.
-template <typename char_type>
-void SendString(const char_type* s) {
- while (*s) {
- char_type ch = *s;
- SendChar(ch, false, false);
- Sleep(10);
- s++;
- }
-}
+void SendStringW(const wchar_t* s);
+void SendStringA(const char* s);
} // end namespace simulate_input