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

Unified Diff: chrome_frame/test/simulate_input.cc

Issue 2173002: Add chrome frame tests for common navigation cases to ensure IE is not broken. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: final Created 10 years, 7 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
« no previous file with comments | « chrome_frame/test/simulate_input.h ('k') | chrome_frame/test/test_mock_with_web_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/test/simulate_input.cc
diff --git a/chrome_frame/test/simulate_input.cc b/chrome_frame/test/simulate_input.cc
index 411f72e4ee06481b011aed1c707452212b7563f1..68d8edc82183528ec5c7dee5c341c2b8fdaf9b3f 100644
--- a/chrome_frame/test/simulate_input.cc
+++ b/chrome_frame/test/simulate_input.cc
@@ -192,29 +192,14 @@ void SetKeyboardFocusToWindow(HWND window) {
SendMouseClick(window, 1, 1, LEFT);
}
-void SendMouseClick(HWND window, int x, int y, MouseButton button) {
- if (!IsWindow(window)) {
- NOTREACHED() << "Invalid window handle.";
- return;
- }
-
- HWND top_level_window = window;
- if (!IsTopLevelWindow(top_level_window)) {
- top_level_window = GetAncestor(window, GA_ROOT);
- }
-
- ForceSetForegroundWindow(top_level_window);
-
- POINT cursor_position = {x, y};
- ClientToScreen(window, &cursor_position);
-
+void SendMouseClick(int x, int y, MouseButton button) {
// TODO(joshia): Fix this. GetSystemMetrics(SM_CXSCREEN) will
// retrieve screen size of the primarary monitor only. And monitors
// arrangement could be pretty arbitrary.
double screen_width = ::GetSystemMetrics(SM_CXSCREEN) - 1;
double screen_height = ::GetSystemMetrics(SM_CYSCREEN) - 1;
- double location_x = cursor_position.x * (65535.0f / screen_width);
- double location_y = cursor_position.y * (65535.0f / screen_height);
+ double location_x = x * (65535.0f / screen_width);
+ double location_y = y * (65535.0f / screen_height);
// Take advantage of button flag bitmask layout
unsigned int button_flag = MOUSEEVENTF_LEFTDOWN << (button + button);
@@ -237,6 +222,24 @@ void SendMouseClick(HWND window, int x, int y, MouseButton button) {
::SendInput(1, &input_info, sizeof(INPUT));
}
+void SendMouseClick(HWND window, int x, int y, MouseButton button) {
+ if (!IsWindow(window)) {
+ NOTREACHED() << "Invalid window handle.";
+ return;
+ }
+
+ HWND top_level_window = window;
+ if (!IsTopLevelWindow(top_level_window)) {
+ top_level_window = GetAncestor(window, GA_ROOT);
+ }
+
+ ForceSetForegroundWindow(top_level_window);
+
+ POINT cursor_position = {x, y};
+ ClientToScreen(window, &cursor_position);
+ SendMouseClick(cursor_position.x, cursor_position.y, button);
+}
+
void SendExtendedKey(WORD key, Modifier modifiers) {
SendMnemonic(key, modifiers, true, false);
}
« no previous file with comments | « chrome_frame/test/simulate_input.h ('k') | chrome_frame/test/test_mock_with_web_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698