Index: ui/events/keycodes/platform_key_map_win_unittest.cc |
diff --git a/ui/events/keycodes/platform_key_map_win_unittest.cc b/ui/events/keycodes/platform_key_map_win_unittest.cc |
index 8359ebecfd2ff01ef69a74a3eed80f6e34981eac..c3c2c85042b60f5e032b63c60db9866b2e9b8be7 100644 |
--- a/ui/events/keycodes/platform_key_map_win_unittest.cc |
+++ b/ui/events/keycodes/platform_key_map_win_unittest.cc |
@@ -21,6 +21,7 @@ enum Layout { |
LAYOUT_US, |
LAYOUT_FR, |
LAYOUT_KR, |
+ LAYOUT_JP, |
}; |
// |LoadKeyboardLayout()| ensures the locale to be loaded into the system |
@@ -44,6 +45,8 @@ HKL GetInputLocale(Layout layout) { |
// on Korean locale. |
// (This issue only happens on Korean and Japanese). |
return reinterpret_cast<HKL>(0x04120412); |
+ case LAYOUT_JP: |
+ return reinterpret_cast<HKL>(0x04110411); |
Wez
2016/07/07 18:25:51
LoadKeyboardLayout doesn't work here?
chongz
2016/07/07 22:18:09
Yes |LoadKeyboardLayout()| won't pass DrMemory tes
Wez
2016/07/08 23:34:07
OK, what I was missing is that we just pull the "p
|
default: |
return 0; |
} |
@@ -319,8 +322,8 @@ TEST_F(PlatformKeyMapTest, KoreanSpecificKeys) { |
HKL us_layout = GetInputLocale(LAYOUT_US); |
PlatformKeyMap us_keymap(us_layout); |
for (const auto& test_case : kKoreanTestCases) { |
- EXPECT_EQ(DomKey::NONE, DomKeyFromKeyboardCodeImpl( |
- us_keymap, test_case.key_code, EF_NONE)) |
+ EXPECT_EQ(DomKey::UNIDENTIFIED, DomKeyFromKeyboardCodeImpl( |
+ us_keymap, test_case.key_code, EF_NONE)) |
<< test_case.key_code; |
} |
@@ -334,4 +337,40 @@ TEST_F(PlatformKeyMapTest, KoreanSpecificKeys) { |
} |
} |
+TEST_F(PlatformKeyMapTest, JapaneseSpecificKeys) { |
+ const struct TestCase { |
+ KeyboardCode key_code; |
+ DomKey jp_key; |
+ DomKey us_key; |
+ } kJapaneseTestCases[] = { |
+ {VKEY_KANA, DomKey::KANA_MODE, DomKey::UNIDENTIFIED}, |
+ {VKEY_KANJI, DomKey::KANJI_MODE, DomKey::UNIDENTIFIED}, |
+ {VKEY_OEM_ATTN, DomKey::ALPHANUMERIC, DomKey::UNIDENTIFIED}, |
+ {VKEY_OEM_FINISH, DomKey::KATAKANA, DomKey::UNIDENTIFIED}, |
+ {VKEY_OEM_COPY, DomKey::HIRAGANA, DomKey::UNIDENTIFIED}, |
+ {VKEY_DBE_SBCSCHAR, DomKey::HANKAKU, DomKey::UNIDENTIFIED}, |
+ {VKEY_DBE_DBCSCHAR, DomKey::ZENKAKU, DomKey::UNIDENTIFIED}, |
+ {VKEY_OEM_BACKTAB, DomKey::ROMAJI, DomKey::UNIDENTIFIED}, |
+ {VKEY_ATTN, DomKey::KANA_MODE, DomKey::ATTN}, |
+ }; |
+ |
+ // US English should not return values for these keys. |
+ HKL us_layout = GetInputLocale(LAYOUT_US); |
+ PlatformKeyMap us_keymap(us_layout); |
Wez
2016/07/07 18:25:51
nit: Here and elsewhere, I think it's OK to pass t
chongz
2016/07/07 22:18:09
Done. Except one place for DomCode=>Key testing.
|
+ for (const auto& test_case : kJapaneseTestCases) { |
Wez
2016/07/07 18:25:51
Suggest folding these two loops into one, for clar
chongz
2016/07/07 22:18:09
Done.
|
+ EXPECT_EQ(test_case.us_key, DomKeyFromKeyboardCodeImpl( |
+ us_keymap, test_case.key_code, EF_NONE)) |
+ << test_case.key_code; |
+ } |
+ |
+ // Japanese layout should return specific DomKey. |
+ HKL jp_layout = GetInputLocale(LAYOUT_JP); |
+ PlatformKeyMap ko_keymap(jp_layout); |
Wez
2016/07/07 18:25:51
jp_keymap?
chongz
2016/07/07 22:18:09
Done.
|
+ for (const auto& test_case : kJapaneseTestCases) { |
+ EXPECT_EQ(test_case.jp_key, DomKeyFromKeyboardCodeImpl( |
+ ko_keymap, test_case.key_code, EF_NONE)) |
+ << test_case.key_code; |
+ } |
+} |
+ |
} // namespace ui |