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 #ifndef CHROME_TEST_WEBDRIVER_KEYMAP_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_KEYMAP_H_ |
6 #define CHROME_TEST_WEBDRIVER_KEYMAP_H_ | 6 #define CHROME_TEST_WEBDRIVER_KEYMAP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/keyboard_codes.h" | 10 #include "app/keyboard_codes.h" |
11 #include "chrome/test/automation/window_proxy.h" | 11 #include "chrome/test/automation/window_proxy.h" |
12 | 12 |
13 namespace webdriver { | 13 namespace webdriver { |
14 | 14 |
15 // Maps the key space used by WebDriver to Chrome for Linux/Mac/Windows. | 15 // Maps the key space used by WebDriver to Chrome for Linux/Mac/Windows. |
16 class KeyMap { | 16 class KeyMap { |
17 public: | 17 public: |
18 KeyMap(); | 18 KeyMap(); |
19 base::KeyboardCode Get(const wchar_t& key) const; | 19 app::KeyboardCode Get(const wchar_t& key) const; |
20 | 20 |
21 bool Press(const scoped_refptr<WindowProxy>& window, | 21 bool Press(const scoped_refptr<WindowProxy>& window, |
22 const base::KeyboardCode key_code, | 22 const app::KeyboardCode key_code, |
23 const wchar_t& key); | 23 const wchar_t& key); |
24 | 24 |
25 // Sets the Shift, Alt, Cntl, and Cmd keys to not pressed | 25 // Sets the Shift, Alt, Cntl, and Cmd keys to not pressed |
26 void ClearModifiers(); | 26 void ClearModifiers(); |
27 | 27 |
28 private: | 28 private: |
29 bool shift_; | 29 bool shift_; |
30 bool alt_; | 30 bool alt_; |
31 bool control_; | 31 bool control_; |
32 bool command_; | 32 bool command_; |
33 std::map<wchar_t, base::KeyboardCode> keys_; | 33 std::map<wchar_t, app::KeyboardCode> keys_; |
34 std::map<wchar_t, base::KeyboardCode> shifted_keys_; | 34 std::map<wchar_t, app::KeyboardCode> shifted_keys_; |
35 DISALLOW_COPY_AND_ASSIGN(KeyMap); | 35 DISALLOW_COPY_AND_ASSIGN(KeyMap); |
36 }; | 36 }; |
37 } // namespace webdriver | 37 } // namespace webdriver |
38 #endif // CHROME_TEST_WEBDRIVER_KEYMAP_H_ | 38 #endif // CHROME_TEST_WEBDRIVER_KEYMAP_H_ |
39 | 39 |
OLD | NEW |