Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: chrome_frame/test/simulate_input.h

Issue 604014: First batch of context menu tests... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_FRAME_TEST_SIMULATE_INPUT_H_
6 #define CHROME_FRAME_TEST_SIMULATE_INPUT_H_
7
8 #include <windows.h>
9
10 #include "base/basictypes.h"
11 #include "base/process_util.h"
12
13 namespace simulate_input {
14
15 // Bring a window into foreground to receive user input.
16 // Note that this may not work on
17 bool ForceSetForegroundWindow(HWND window);
18
19 // Looks for a top level window owned by the given process id and
20 // calls ForceSetForegroundWindow on it.
21 bool EnsureProcessInForeground(base::ProcessId process_id);
22
23 // Helper function to set keyboard focus to a window. This is achieved by
24 // sending a mouse move followed by a mouse down/mouse up combination to the
25 // window.
26 void SetKeyboardFocusToWindow(HWND window);
27
28 // Sends a keystroke to the currently active application with optional
29 // modifiers set.
30 bool SendMnemonic(WORD mnemonic_char, bool shift_pressed, bool control_pressed,
31 bool alt_pressed, bool extended, bool unicode);
32
33 // Sends a mouse click to the window passed in.
34 enum MouseButton { LEFT, RIGHT, MIDDLE, X };
35 void SendMouseClick(HWND window, int x, int y, MouseButton button);
36
37 // Translates a single char to a virtual key and calls SendVirtualKey.
38 void SendChar(char c, bool control, bool alt);
39 void SendChar(wchar_t c, bool control, bool alt);
40
41 // Sends extended keystroke to the currently active application with optional
42 // modifiers set.
43 bool SendExtendedKey(WORD key, bool shift, bool control, bool alt);
44
45 // Iterates through all the characters in the string and simulates
46 // keyboard input. The input goes to the currently active application.
47 template <typename char_type>
48 void SendString(const char_type* s) {
49 while (*s) {
50 char_type ch = *s;
51 SendChar(ch, false, false);
52 Sleep(100);
53 s++;
54 }
55 }
56
57 } // end namespace simulate_input
58
59 #endif // CHROME_FRAME_TEST_SIMULATE_INPUT_H_
60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698