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 #include "content/test/mock_keyboard_driver_win.h" | 5 #include "content/test/mock_keyboard_driver_win.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/test/mock_keyboard.h" | 9 #include "content/test/mock_keyboard.h" |
10 | 10 |
| 11 namespace content { |
| 12 |
11 MockKeyboardDriverWin::MockKeyboardDriverWin() { | 13 MockKeyboardDriverWin::MockKeyboardDriverWin() { |
12 // Save the keyboard layout and status of the application. | 14 // Save the keyboard layout and status of the application. |
13 // This class changes the keyboard layout and status of this application. | 15 // This class changes the keyboard layout and status of this application. |
14 // This change may break succeeding tests. To prevent this possible break, we | 16 // This change may break succeeding tests. To prevent this possible break, we |
15 // should save the layout and status here to restore when this instance is | 17 // should save the layout and status here to restore when this instance is |
16 // destroyed. | 18 // destroyed. |
17 original_keyboard_layout_ = GetKeyboardLayout(0); | 19 original_keyboard_layout_ = GetKeyboardLayout(0); |
18 active_keyboard_layout_ = original_keyboard_layout_; | 20 active_keyboard_layout_ = original_keyboard_layout_; |
19 GetKeyboardState(&original_keyboard_states_[0]); | 21 GetKeyboardState(&original_keyboard_states_[0]); |
20 | 22 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // the mofifiers. | 156 // the mofifiers. |
155 CHECK(output); | 157 CHECK(output); |
156 wchar_t code[16]; | 158 wchar_t code[16]; |
157 int length = ToUnicodeEx(key_code, MapVirtualKey(key_code, 0), | 159 int length = ToUnicodeEx(key_code, MapVirtualKey(key_code, 0), |
158 &keyboard_states_[0], &code[0], arraysize(code), 0, | 160 &keyboard_states_[0], &code[0], arraysize(code), 0, |
159 active_keyboard_layout_); | 161 active_keyboard_layout_); |
160 if (length > 0) | 162 if (length > 0) |
161 output->assign(code); | 163 output->assign(code); |
162 return length; | 164 return length; |
163 } | 165 } |
| 166 |
| 167 } // namespace content |
OLD | NEW |