Index: chrome/test/chromedriver/keycode_text_conversion_unittest.cc |
diff --git a/chrome/test/chromedriver/keycode_text_conversion_unittest.cc b/chrome/test/chromedriver/keycode_text_conversion_unittest.cc |
index 573d1d280562be7e83442313a3cd6c146aafac22..bef917bcc3bb7c73a6944d94af3c556f0bc27208 100644 |
--- a/chrome/test/chromedriver/keycode_text_conversion_unittest.cc |
+++ b/chrome/test/chromedriver/keycode_text_conversion_unittest.cc |
@@ -9,9 +9,9 @@ |
#include "build/build_config.h" |
#include "chrome/test/chromedriver/chrome/ui_events.h" |
#include "chrome/test/chromedriver/keycode_text_conversion.h" |
-#include "chrome/test/chromedriver/test_util.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/events/keycodes/keyboard_codes.h" |
+#include "ui/events/test/keyboard_layout.h" |
namespace { |
@@ -127,14 +127,12 @@ TEST(KeycodeTextConversionTest, MAYBE_CharToKeyCode) { |
#endif |
TEST(KeycodeTextConversionTest, MAYBE_NonShiftModifiers) { |
- RestoreKeyboardLayoutOnDestruct restore; |
+ ui::ScopedKeyboardLayout keyboard_layout(ui::KEYBOARD_LAYOUT_GERMAN); |
#if defined(OS_WIN) |
- ASSERT_TRUE(SwitchKeyboardLayout("00000407")); // german |
int ctrl_and_alt = kControlKeyModifierMask | kAltKeyModifierMask; |
CheckCharToKeyCode('@', ui::VKEY_Q, ctrl_and_alt); |
EXPECT_EQ("@", ConvertKeyCodeToTextNoError(ui::VKEY_Q, ctrl_and_alt)); |
#elif defined(OS_MACOSX) |
- ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German")); |
EXPECT_EQ("@", ConvertKeyCodeToTextNoError( |
ui::VKEY_L, kAltKeyModifierMask)); |
#endif |
@@ -149,18 +147,21 @@ TEST(KeycodeTextConversionTest, MAYBE_NonShiftModifiers) { |
#endif |
TEST(KeycodeTextConversionTest, MAYBE_NonEnglish) { |
- RestoreKeyboardLayoutOnDestruct restore; |
#if defined(OS_WIN) |
- ASSERT_TRUE(SwitchKeyboardLayout("00000408")); // greek |
- CheckCharToKeyCode(';', ui::VKEY_Q, 0); |
- EXPECT_EQ(";", ConvertKeyCodeToTextNoError(ui::VKEY_Q, 0)); |
- // Regression test for chromedriver bug #405. |
- ASSERT_TRUE(SwitchKeyboardLayout("00000419")); // russian |
- CheckCharToKeyCode(L'\u0438', ui::VKEY_B, 0); |
- EXPECT_EQ(base::UTF16ToUTF8(L"\u0438"), |
- ConvertKeyCodeToTextNoError(ui::VKEY_B, 0)); |
+ { |
+ ui::ScopedKeyboardLayout greek_layout(ui::KEYBOARD_LAYOUT_GREEK); |
+ CheckCharToKeyCode(';', ui::VKEY_Q, 0); |
+ EXPECT_EQ(";", ConvertKeyCodeToTextNoError(ui::VKEY_Q, 0)); |
+ } |
+ { |
+ // Regression test for chromedriver bug #405. |
+ ui::ScopedKeyboardLayout russian_layout(ui::KEYBOARD_LAYOUT_RUSSIAN); |
+ CheckCharToKeyCode(L'\u0438', ui::VKEY_B, 0); |
+ EXPECT_EQ(base::UTF16ToUTF8(L"\u0438"), |
+ ConvertKeyCodeToTextNoError(ui::VKEY_B, 0)); |
+ } |
Peter Kasting
2016/08/26 18:54:33
In principle, is there a reason why these tests wo
Tomasz Moniuszko
2016/08/31 15:29:42
I tested Greek and Russian keyboard layouts on Mac
Peter Kasting
2016/08/31 21:16:15
That sounds like those tests should be enabled on
chongz
2016/09/03 00:44:17
The following comments are not verified, please re
Tomasz Moniuszko
2016/09/07 11:19:01
I think this is the right answer. Windows system u
|
#elif defined(OS_MACOSX) |
- ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German")); |
+ ui::ScopedKeyboardLayout german_layout(ui::KEYBOARD_LAYOUT_GERMAN); |
CheckCharToKeyCode('z', ui::VKEY_Y, 0); |
EXPECT_EQ("z", ConvertKeyCodeToTextNoError(ui::VKEY_Y, 0)); |
#endif |