OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/string16.h" | 7 #include "base/string16.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/test/chromedriver/keycode_text_conversion.h" | 9 #include "chrome/test/chromedriver/keycode_text_conversion.h" |
10 #include "chrome/test/chromedriver/test_util.h" | 10 #include "chrome/test/chromedriver/test_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 int actual_modifiers = 0; | 23 int actual_modifiers = 0; |
24 ASSERT_TRUE(ConvertCharToKeyCode( | 24 ASSERT_TRUE(ConvertCharToKeyCode( |
25 character_utf16, &actual_key_code, &actual_modifiers)); | 25 character_utf16, &actual_key_code, &actual_modifiers)); |
26 EXPECT_EQ(key_code, actual_key_code) << "Char: " << character; | 26 EXPECT_EQ(key_code, actual_key_code) << "Char: " << character; |
27 EXPECT_EQ(modifiers, actual_modifiers) << "Char: " << character; | 27 EXPECT_EQ(modifiers, actual_modifiers) << "Char: " << character; |
28 } | 28 } |
29 | 29 |
30 void CheckCantConvertChar(wchar_t character) { | 30 void CheckCantConvertChar(wchar_t character) { |
31 std::wstring character_string; | 31 std::wstring character_string; |
32 character_string.push_back(character); | 32 character_string.push_back(character); |
33 char16 character_utf16 = WideToUTF16(character_string)[0]; | 33 char16 character_utf16 = base::WideToUTF16(character_string)[0]; |
34 ui::KeyboardCode actual_key_code = ui::VKEY_UNKNOWN; | 34 ui::KeyboardCode actual_key_code = ui::VKEY_UNKNOWN; |
35 int actual_modifiers = 0; | 35 int actual_modifiers = 0; |
36 EXPECT_FALSE(ConvertCharToKeyCode( | 36 EXPECT_FALSE(ConvertCharToKeyCode( |
37 character_utf16, &actual_key_code, &actual_modifiers)); | 37 character_utf16, &actual_key_code, &actual_modifiers)); |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) |
43 // Fails on bots: crbug.com/174962 | 43 // Fails on bots: crbug.com/174962 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
126 ASSERT_TRUE(SwitchKeyboardLayout("00000408")); // greek | 126 ASSERT_TRUE(SwitchKeyboardLayout("00000408")); // greek |
127 CheckCharToKeyCode(';', ui::VKEY_Q, 0); | 127 CheckCharToKeyCode(';', ui::VKEY_Q, 0); |
128 EXPECT_EQ(";", ConvertKeyCodeToText(ui::VKEY_Q, 0)); | 128 EXPECT_EQ(";", ConvertKeyCodeToText(ui::VKEY_Q, 0)); |
129 #elif defined(OS_MACOSX) | 129 #elif defined(OS_MACOSX) |
130 ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German")); | 130 ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German")); |
131 CheckCharToKeyCode('z', ui::VKEY_Y, 0); | 131 CheckCharToKeyCode('z', ui::VKEY_Y, 0); |
132 EXPECT_EQ("z", ConvertKeyCodeToText(ui::VKEY_Y, 0)); | 132 EXPECT_EQ("z", ConvertKeyCodeToText(ui::VKEY_Y, 0)); |
133 #endif | 133 #endif |
134 } | 134 } |
OLD | NEW |