| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_KEY_CONVERTER_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_KEY_CONVERTER_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_KEY_CONVERTER_H_ | 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_KEY_CONVERTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/test/webdriver/automation.h" | 13 #include "chrome/test/webdriver/automation.h" |
| 14 #include "ui/base/keycodes/keyboard_codes.h" | 14 #include "ui/base/keycodes/keyboard_codes.h" |
| 15 | 15 |
| 16 namespace webdriver { | 16 namespace webdriver { |
| 17 | 17 |
| 18 // Convenience functions for creating |WebKeyEvent|s. Used by unittests. | 18 // Convenience functions for creating |WebKeyEvent|s. Used by unittests. |
| 19 WebKeyEvent CreateKeyDownEvent(ui::KeyboardCode key_code, int modifiers); | 19 WebKeyEvent CreateKeyDownEvent(ui::KeyboardCode key_code, int modifiers); |
| 20 WebKeyEvent CreateKeyUpEvent(ui::KeyboardCode key_code, int modifiers); | 20 WebKeyEvent CreateKeyUpEvent(ui::KeyboardCode key_code, int modifiers); |
| 21 WebKeyEvent CreateCharEvent(const std::string& unmodified_text, | 21 WebKeyEvent CreateCharEvent(const std::string& unmodified_text, |
| 22 const std::string& modified_text, | 22 const std::string& modified_text, |
| 23 int modifiers); | 23 int modifiers); |
| 24 | 24 |
| 25 // Converts keys into appropriate |WebKeyEvent|s. | 25 // Converts keys into appropriate |WebKeyEvent|s. This will do a best effort |
| 26 void ConvertKeysToWebKeyEvents(const string16& keys, | 26 // conversion. However, if the input is invalid it will return false and set |
| 27 std::vector<WebKeyEvent>* key_events); | 27 // an error message. |
| 28 bool ConvertKeysToWebKeyEvents(const string16& keys, |
| 29 std::vector<WebKeyEvent>* key_events, |
| 30 std::string* error_msg); |
| 28 | 31 |
| 29 } // namespace webdriver | 32 } // namespace webdriver |
| 30 | 33 |
| 31 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_KEY_CONVERTER_H_ | 34 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_KEY_CONVERTER_H_ |
| OLD | NEW |