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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome_frame/test/simulate_input.h
===================================================================
--- chrome_frame/test/simulate_input.h (revision 0)
+++ chrome_frame/test/simulate_input.h (revision 0)
@@ -0,0 +1,60 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_FRAME_TEST_SIMULATE_INPUT_H_
+#define CHROME_FRAME_TEST_SIMULATE_INPUT_H_
+
+#include <windows.h>
+
+#include "base/basictypes.h"
+#include "base/process_util.h"
+
+namespace simulate_input {
+
+// Bring a window into foreground to receive user input.
+// Note that this may not work on
+bool ForceSetForegroundWindow(HWND window);
+
+// Looks for a top level window owned by the given process id and
+// calls ForceSetForegroundWindow on it.
+bool EnsureProcessInForeground(base::ProcessId process_id);
+
+// Helper function to set keyboard focus to a window. This is achieved by
+// sending a mouse move followed by a mouse down/mouse up combination to the
+// window.
+void SetKeyboardFocusToWindow(HWND window);
+
+// Sends a keystroke to the currently active application with optional
+// modifiers set.
+bool SendMnemonic(WORD mnemonic_char, bool shift_pressed, bool control_pressed,
+ bool alt_pressed, 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 SendChar(char c, bool control, bool alt);
+void SendChar(wchar_t c, bool control, bool alt);
+
+// Sends extended keystroke to the currently active application with optional
+// modifiers set.
+bool SendExtendedKey(WORD key, bool shift, bool control, bool alt);
+
+// 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(100);
+ s++;
+ }
+}
+
+} // end namespace simulate_input
+
+#endif // CHROME_FRAME_TEST_SIMULATE_INPUT_H_
+
Property changes on: chrome_frame\test\simulate_input.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698