| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome_frame/test/simulate_input.h" | 5 #include "chrome_frame/test/simulate_input.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlwin.h> | 8 #include <atlwin.h> |
| 9 | 9 |
| 10 #include "chrome_frame/utils.h" | 10 #include "chrome_frame/utils.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 POINT cursor_position = {x, y}; | 238 POINT cursor_position = {x, y}; |
| 239 ClientToScreen(window, &cursor_position); | 239 ClientToScreen(window, &cursor_position); |
| 240 SendMouseClick(cursor_position.x, cursor_position.y, button); | 240 SendMouseClick(cursor_position.x, cursor_position.y, button); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void SendExtendedKey(WORD key, Modifier modifiers) { | 243 void SendExtendedKey(WORD key, Modifier modifiers) { |
| 244 SendMnemonic(key, modifiers, true, false); | 244 SendMnemonic(key, modifiers, true, false); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void SendStringW(const wchar_t* s) { | 247 void SendStringW(const std::wstring& s) { |
| 248 while (*s) { | 248 for (size_t i = 0; i < s.length(); i++) { |
| 249 wchar_t ch = *s; | 249 SendCharW(s[i], NONE); |
| 250 SendCharW(ch, NONE); | |
| 251 Sleep(10); | 250 Sleep(10); |
| 252 s++; | |
| 253 } | 251 } |
| 254 } | 252 } |
| 255 | 253 |
| 256 void SendStringA(const char* s) { | 254 void SendStringA(const std::string& s) { |
| 257 while (*s) { | 255 for (size_t i = 0; i < s.length(); i++) { |
| 258 char ch = *s; | 256 SendCharA(s[i], NONE); |
| 259 SendCharA(ch, NONE); | |
| 260 Sleep(10); | 257 Sleep(10); |
| 261 s++; | |
| 262 } | 258 } |
| 263 } | 259 } |
| 264 | 260 |
| 265 } // namespace simulate_input | 261 } // namespace simulate_input |
| 266 | 262 |
| OLD | NEW |