1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/utf_string_conversions.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/base/ime/chromeos/extension_ime_util.h"
14 #include "ui/base/ime/chromeos/fake_input_method_delegate.h"
15 #include "ui/base/ime/chromeos/input_method_manager.h"
16 #include "ui/base/ime/chromeos/input_method_whitelist.h"
17 #include "ui/base/l10n/l10n_util.h"
19 using base::ASCIIToUTF16
;
23 extern const char* kExtensionImePrefix
;
25 namespace input_method
{
29 const char pinyin_ime_id
[] = "zh-t-i0-pinyin";
30 const char zhuyin_ime_id
[] = "zh-hant-t-i0-und";
32 class TestableInputMethodUtil
: public InputMethodUtil
{
34 explicit TestableInputMethodUtil(InputMethodDelegate
* delegate
,
35 scoped_ptr
<InputMethodDescriptors
> methods
)
36 : InputMethodUtil(delegate
) {
37 ResetInputMethods(*methods
);
39 // Change access rights.
40 using InputMethodUtil::GetInputMethodIdsFromLanguageCodeInternal
;
41 using InputMethodUtil::GetKeyboardLayoutName
;
46 class InputMethodUtilTest
: public testing::Test
{
49 : util_(&delegate_
, whitelist_
.GetSupportedInputMethods()) {
50 delegate_
.set_get_localized_string_callback(
51 base::Bind(&l10n_util::GetStringUTF16
));
52 delegate_
.set_get_display_language_name_callback(
53 base::Bind(&InputMethodUtilTest::GetDisplayLanguageName
));
56 void SetUp() override
{
57 InputMethodDescriptors input_methods
;
59 std::vector
<std::string
> layouts
;
60 std::vector
<std::string
> languages
;
61 layouts
.push_back("us");
62 languages
.push_back("zh-CN");
64 InputMethodDescriptor
pinyin_ime(Id(pinyin_ime_id
),
65 "Pinyin input for testing",
72 input_methods
.push_back(pinyin_ime
);
75 languages
.push_back("zh-TW");
76 InputMethodDescriptor
zhuyin_ime(zhuyin_ime_id
,
77 "Zhuyin input for testing",
84 input_methods
.push_back(zhuyin_ime
);
86 util_
.InitXkbInputMethodsForTesting();
87 util_
.AppendInputMethods(input_methods
);
90 std::string
Id(const std::string
& id
) {
91 return extension_ime_util::GetInputMethodIDByEngineID(id
);
94 InputMethodDescriptor
GetDesc(const std::string
& id
,
95 const std::string
& raw_layout
,
96 const std::string
& language_code
,
97 const std::string
& indicator
) {
98 std::vector
<std::string
> layouts
;
99 layouts
.push_back(raw_layout
);
100 std::vector
<std::string
> languages
;
101 languages
.push_back(language_code
);
102 return InputMethodDescriptor(Id(id
),
104 indicator
, // Short name used for indicator.
108 GURL(), // options page url
109 GURL()); // input view page url
112 static base::string16
GetDisplayLanguageName(const std::string
& language_code
) {
113 return l10n_util::GetDisplayNameForLocale(language_code
, "en", true);
116 FakeInputMethodDelegate delegate_
;
117 InputMethodWhitelist whitelist_
;
118 TestableInputMethodUtil util_
;
121 TEST_F(InputMethodUtilTest
, GetInputMethodShortNameTest
) {
122 // Test invalid cases. Two-letter language code should be returned.
124 InputMethodDescriptor desc
= GetDesc("invalid-id", "us", "xx", "");
125 // Upper-case string of the unknown language code, "xx", should be returned.
126 EXPECT_EQ(ASCIIToUTF16("XX"), util_
.GetInputMethodShortName(desc
));
129 // Test special cases.
131 InputMethodDescriptor desc
=
132 GetDesc("xkb:us:dvorak:eng", "us", "en-US", "DV");
133 EXPECT_EQ(ASCIIToUTF16("DV"), util_
.GetInputMethodShortName(desc
));
136 InputMethodDescriptor desc
=
137 GetDesc("xkb:us:colemak:eng", "us", "en-US", "CO");
138 EXPECT_EQ(ASCIIToUTF16("CO"), util_
.GetInputMethodShortName(desc
));
141 InputMethodDescriptor desc
=
142 GetDesc("xkb:us:altgr-intl:eng", "us", "en-US", "EXTD");
143 EXPECT_EQ(ASCIIToUTF16("EXTD"), util_
.GetInputMethodShortName(desc
));
146 InputMethodDescriptor desc
=
147 GetDesc("xkb:us:intl:eng", "us", "en-US", "INTL");
148 EXPECT_EQ(ASCIIToUTF16("INTL"), util_
.GetInputMethodShortName(desc
));
151 InputMethodDescriptor desc
=
152 GetDesc("xkb:de:neo:ger", "de(neo)", "de", "NEO");
153 EXPECT_EQ(ASCIIToUTF16("NEO"), util_
.GetInputMethodShortName(desc
));
156 InputMethodDescriptor desc
=
157 GetDesc("xkb:es:cat:cat", "es(cat)", "ca", "CAS");
158 EXPECT_EQ(ASCIIToUTF16("CAS"), util_
.GetInputMethodShortName(desc
));
161 InputMethodDescriptor desc
=
162 GetDesc(pinyin_ime_id
, "us", "zh-CN", "\xe6\x8b\xbc");
163 EXPECT_EQ(base::UTF8ToUTF16("\xe6\x8b\xbc"),
164 util_
.GetInputMethodShortName(desc
));
167 InputMethodDescriptor desc
=
168 GetDesc(zhuyin_ime_id
, "us", "zh-TW", "\xE6\xB3\xA8");
169 EXPECT_EQ(base::UTF8ToUTF16("\xE6\xB3\xA8"),
170 util_
.GetInputMethodShortName(desc
));
174 TEST_F(InputMethodUtilTest
, GetInputMethodMediumNameTest
) {
176 // input methods with medium name equal to short name
177 const char * input_method_id
[] = {
178 "xkb:us:altgr-intl:eng",
181 "xkb:us:colemak:eng",
186 const int len
= arraysize(input_method_id
);
187 for (int i
=0; i
<len
; ++i
) {
188 InputMethodDescriptor desc
= GetDesc(input_method_id
[i
], "", "", "");
189 base::string16 medium_name
= util_
.GetInputMethodMediumName(desc
);
190 base::string16 short_name
= util_
.GetInputMethodShortName(desc
);
191 EXPECT_EQ(medium_name
,short_name
);
195 // input methods with medium name not equal to short name
196 const char * input_method_id
[] = {
200 const int len
= arraysize(input_method_id
);
201 for (int i
=0; i
<len
; ++i
) {
202 InputMethodDescriptor desc
= GetDesc(input_method_id
[i
], "", "", "");
203 base::string16 medium_name
= util_
.GetInputMethodMediumName(desc
);
204 base::string16 short_name
= util_
.GetInputMethodShortName(desc
);
205 EXPECT_NE(medium_name
,short_name
);
210 TEST_F(InputMethodUtilTest
, GetInputMethodLongNameTest
) {
211 // For most languages input method or keyboard layout name is returned.
212 // See below for exceptions.
214 InputMethodDescriptor desc
= GetDesc("xkb:jp::jpn", "jp", "ja", "");
215 EXPECT_EQ(ASCIIToUTF16("Japanese"),
216 util_
.GetInputMethodLongName(desc
));
219 InputMethodDescriptor desc
=
220 GetDesc("xkb:us:dvorak:eng", "us(dvorak)", "en-US", "");
221 EXPECT_EQ(ASCIIToUTF16("US Dvorak"),
222 util_
.GetInputMethodLongName(desc
));
225 InputMethodDescriptor desc
=
226 GetDesc("xkb:gb:dvorak:eng", "gb(dvorak)", "en-US", "");
227 EXPECT_EQ(ASCIIToUTF16("UK Dvorak"),
228 util_
.GetInputMethodLongName(desc
));
231 // For Dutch, French, German and Hindi,
232 // "language - keyboard layout" pair is returned.
234 InputMethodDescriptor desc
= GetDesc("xkb:be::nld", "be", "nl", "");
235 EXPECT_EQ(ASCIIToUTF16("Dutch - Belgian"),
236 util_
.GetInputMethodLongName(desc
));
239 InputMethodDescriptor desc
= GetDesc("xkb:fr::fra", "fr", "fr", "");
240 EXPECT_EQ(ASCIIToUTF16("French - French"),
241 util_
.GetInputMethodLongName(desc
));
244 InputMethodDescriptor desc
= GetDesc("xkb:be::fra", "be", "fr", "");
245 EXPECT_EQ(ASCIIToUTF16("French - Belgian"),
246 util_
.GetInputMethodLongName(desc
));
249 InputMethodDescriptor desc
= GetDesc("xkb:de::ger", "de", "de", "");
250 EXPECT_EQ(ASCIIToUTF16("German - German"),
251 util_
.GetInputMethodLongName(desc
));
254 InputMethodDescriptor desc
= GetDesc("xkb:be::ger", "be", "de", "");
255 EXPECT_EQ(ASCIIToUTF16("German - Belgian"),
256 util_
.GetInputMethodLongName(desc
));
260 InputMethodDescriptor desc
= GetDesc("invalid-id", "us", "xx", "");
261 // You can safely ignore the "Resouce ID is not found for: invalid-id"
263 EXPECT_EQ(ASCIIToUTF16("invalid-id"),
264 util_
.GetInputMethodLongName(desc
));
268 TEST_F(InputMethodUtilTest
, TestIsValidInputMethodId
) {
269 EXPECT_TRUE(util_
.IsValidInputMethodId(Id("xkb:us:colemak:eng")));
270 EXPECT_TRUE(util_
.IsValidInputMethodId(Id(pinyin_ime_id
)));
271 EXPECT_FALSE(util_
.IsValidInputMethodId("unsupported-input-method"));
274 TEST_F(InputMethodUtilTest
, TestIsKeyboardLayout
) {
275 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng"));
276 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout(Id(pinyin_ime_id
)));
279 TEST_F(InputMethodUtilTest
, TestGetKeyboardLayoutName
) {
281 EXPECT_EQ("", util_
.GetKeyboardLayoutName("UNSUPPORTED_ID"));
283 // Supported cases (samples).
284 EXPECT_EQ("us", util_
.GetKeyboardLayoutName(Id(pinyin_ime_id
)));
285 EXPECT_EQ("es", util_
.GetKeyboardLayoutName(Id("xkb:es::spa")));
286 EXPECT_EQ("es(cat)", util_
.GetKeyboardLayoutName(Id("xkb:es:cat:cat")));
287 EXPECT_EQ("gb(extd)", util_
.GetKeyboardLayoutName(Id("xkb:gb:extd:eng")));
288 EXPECT_EQ("us", util_
.GetKeyboardLayoutName(Id("xkb:us::eng")));
289 EXPECT_EQ("us(dvorak)", util_
.GetKeyboardLayoutName(Id("xkb:us:dvorak:eng")));
290 EXPECT_EQ("us(colemak)",
291 util_
.GetKeyboardLayoutName(Id("xkb:us:colemak:eng")));
292 EXPECT_EQ("de(neo)", util_
.GetKeyboardLayoutName(Id("xkb:de:neo:ger")));
295 TEST_F(InputMethodUtilTest
, TestGetInputMethodDisplayNameFromId
) {
297 util_
.GetInputMethodDisplayNameFromId("xkb:us::eng"));
298 EXPECT_EQ("", util_
.GetInputMethodDisplayNameFromId("nonexistent"));
301 TEST_F(InputMethodUtilTest
, TestGetInputMethodDescriptorFromId
) {
302 EXPECT_EQ(NULL
, util_
.GetInputMethodDescriptorFromId("non_existent"));
304 const InputMethodDescriptor
* descriptor
=
305 util_
.GetInputMethodDescriptorFromId(Id(pinyin_ime_id
));
306 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
307 EXPECT_EQ(Id(pinyin_ime_id
), descriptor
->id());
308 EXPECT_EQ("us", descriptor
->GetPreferredKeyboardLayout());
309 // This used to be "zh" but now we have "zh-CN" in input_methods.h,
310 // hence this should be zh-CN now.
311 ASSERT_TRUE(!descriptor
->language_codes().empty());
312 EXPECT_EQ("zh-CN", descriptor
->language_codes().at(0));
315 TEST_F(InputMethodUtilTest
, TestGetInputMethodIdsForLanguageCode
) {
316 std::multimap
<std::string
, std::string
> language_code_to_ids_map
;
317 language_code_to_ids_map
.insert(std::make_pair("ja", pinyin_ime_id
));
318 language_code_to_ids_map
.insert(std::make_pair("ja", pinyin_ime_id
));
319 language_code_to_ids_map
.insert(std::make_pair("ja", "xkb:jp:jpn"));
320 language_code_to_ids_map
.insert(std::make_pair("fr", "xkb:fr:fra"));
322 std::vector
<std::string
> result
;
323 EXPECT_TRUE(util_
.GetInputMethodIdsFromLanguageCodeInternal(
324 language_code_to_ids_map
, "ja", kAllInputMethods
, &result
));
325 EXPECT_EQ(3U, result
.size());
326 EXPECT_TRUE(util_
.GetInputMethodIdsFromLanguageCodeInternal(
327 language_code_to_ids_map
, "ja", kKeyboardLayoutsOnly
, &result
));
328 ASSERT_EQ(1U, result
.size());
329 EXPECT_EQ("xkb:jp:jpn", result
[0]);
331 EXPECT_TRUE(util_
.GetInputMethodIdsFromLanguageCodeInternal(
332 language_code_to_ids_map
, "fr", kAllInputMethods
, &result
));
333 ASSERT_EQ(1U, result
.size());
334 EXPECT_EQ("xkb:fr:fra", result
[0]);
335 EXPECT_TRUE(util_
.GetInputMethodIdsFromLanguageCodeInternal(
336 language_code_to_ids_map
, "fr", kKeyboardLayoutsOnly
, &result
));
337 ASSERT_EQ(1U, result
.size());
338 EXPECT_EQ("xkb:fr:fra", result
[0]);
340 EXPECT_FALSE(util_
.GetInputMethodIdsFromLanguageCodeInternal(
341 language_code_to_ids_map
, "invalid_lang", kAllInputMethods
, &result
));
342 EXPECT_FALSE(util_
.GetInputMethodIdsFromLanguageCodeInternal(
343 language_code_to_ids_map
, "invalid_lang", kKeyboardLayoutsOnly
, &result
));
346 // US keyboard + English US UI = US keyboard only.
347 TEST_F(InputMethodUtilTest
, TestGetFirstLoginInputMethodIds_Us_And_EnUs
) {
348 const InputMethodDescriptor
* descriptor
=
349 util_
.GetInputMethodDescriptorFromId(Id("xkb:us::eng")); // US keyboard.
350 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
351 std::vector
<std::string
> input_method_ids
;
352 util_
.GetFirstLoginInputMethodIds("en-US", *descriptor
, &input_method_ids
);
353 ASSERT_EQ(1U, input_method_ids
.size());
354 EXPECT_EQ(Id("xkb:us::eng"), input_method_ids
[0]);
357 // US keyboard + Chinese UI = US keyboard + Pinyin IME.
358 TEST_F(InputMethodUtilTest
, TestGetFirstLoginInputMethodIds_Us_And_Zh
) {
359 const InputMethodDescriptor
* descriptor
=
360 util_
.GetInputMethodDescriptorFromId(Id("xkb:us::eng")); // US keyboard.
361 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
362 std::vector
<std::string
> input_method_ids
;
363 util_
.GetFirstLoginInputMethodIds("zh-CN", *descriptor
, &input_method_ids
);
364 ASSERT_EQ(2U, input_method_ids
.size());
365 EXPECT_EQ(Id("xkb:us::eng"), input_method_ids
[0]);
366 EXPECT_EQ(Id(pinyin_ime_id
), input_method_ids
[1]); // Pinyin for US keybaord.
369 // US keyboard + Russian UI = US keyboard + Russsian keyboard
370 TEST_F(InputMethodUtilTest
, TestGetFirstLoginInputMethodIds_Us_And_Ru
) {
371 const InputMethodDescriptor
* descriptor
=
372 util_
.GetInputMethodDescriptorFromId(Id("xkb:us::eng")); // US keyboard.
373 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
374 std::vector
<std::string
> input_method_ids
;
375 util_
.GetFirstLoginInputMethodIds("ru", *descriptor
, &input_method_ids
);
376 ASSERT_EQ(2U, input_method_ids
.size());
377 EXPECT_EQ(Id("xkb:us::eng"), input_method_ids
[0]);
378 EXPECT_EQ(Id("xkb:ru::rus"), input_method_ids
[1]); // Russian keyboard.
381 // US keyboard + Traditional Chinese = US keyboard + chewing.
382 TEST_F(InputMethodUtilTest
, TestGetFirstLoginInputMethodIds_Us_And_ZhTw
) {
383 const InputMethodDescriptor
* descriptor
=
384 util_
.GetInputMethodDescriptorFromId(Id("xkb:us::eng")); // US keyboard.
385 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
386 std::vector
<std::string
> input_method_ids
;
387 util_
.GetFirstLoginInputMethodIds("zh-TW", *descriptor
, &input_method_ids
);
388 ASSERT_EQ(2U, input_method_ids
.size());
389 EXPECT_EQ(Id("xkb:us::eng"), input_method_ids
[0]);
390 EXPECT_EQ(Id(zhuyin_ime_id
), input_method_ids
[1]); // Chewing.
393 // US keyboard + Thai = US keyboard + kesmanee.
394 TEST_F(InputMethodUtilTest
, TestGetFirstLoginInputMethodIds_Us_And_Th
) {
395 const InputMethodDescriptor
* descriptor
=
396 util_
.GetInputMethodDescriptorFromId(Id("xkb:us::eng")); // US keyboard.
397 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
398 std::vector
<std::string
> input_method_ids
;
399 util_
.GetFirstLoginInputMethodIds("th", *descriptor
, &input_method_ids
);
400 ASSERT_EQ(2U, input_method_ids
.size());
401 EXPECT_EQ(Id("xkb:us::eng"), input_method_ids
[0]);
402 EXPECT_EQ(Id("vkd_th"), input_method_ids
[1]); // Kesmanee.
405 // US keyboard + Vietnamese = US keyboard + TCVN6064.
406 TEST_F(InputMethodUtilTest
, TestGetFirstLoginInputMethodIds_Us_And_Vi
) {
407 const InputMethodDescriptor
* descriptor
=
408 util_
.GetInputMethodDescriptorFromId(Id("xkb:us::eng")); // US keyboard.
409 ASSERT_TRUE(NULL
!= descriptor
); // ASSERT_NE doesn't compile.
410 std::vector
<std::string
> input_method_ids
;
411 util_
.GetFirstLoginInputMethodIds("vi", *descriptor
, &input_method_ids
);
412 ASSERT_EQ(2U, input_method_ids
.size());
413 EXPECT_EQ(Id("xkb:us::eng"), input_method_ids
[0]);
414 EXPECT_EQ(Id("vkd_vi_tcvn"), input_method_ids
[1]); // TCVN6064.
417 TEST_F(InputMethodUtilTest
, TestGetLanguageCodesFromInputMethodIds
) {
418 std::vector
<std::string
> input_method_ids
;
419 input_method_ids
.push_back(Id("xkb:us::eng")); // English US.
420 input_method_ids
.push_back(Id("xkb:us:dvorak:eng")); // English US Dvorak.
421 input_method_ids
.push_back(Id(pinyin_ime_id
)); // Pinyin
422 input_method_ids
.push_back(Id("xkb:fr::fra")); // French France.
423 std::vector
<std::string
> language_codes
;
424 util_
.GetLanguageCodesFromInputMethodIds(input_method_ids
, &language_codes
);
425 ASSERT_EQ(3U, language_codes
.size());
426 EXPECT_EQ("en", language_codes
[0]);
427 EXPECT_EQ("zh-CN", language_codes
[1]);
428 EXPECT_EQ("fr", language_codes
[2]);
431 // Test all supported descriptors to detect a typo in input_methods.txt.
432 TEST_F(InputMethodUtilTest
, TestIBusInputMethodText
) {
433 const std::map
<std::string
, InputMethodDescriptor
>& id_to_descriptor
=
434 util_
.GetIdToDesciptorMapForTesting();
435 for (std::map
<std::string
, InputMethodDescriptor
>::const_iterator it
=
436 id_to_descriptor
.begin(); it
!= id_to_descriptor
.end(); ++it
) {
437 const std::string language_code
= it
->second
.language_codes().at(0);
438 const base::string16 display_name
=
439 l10n_util::GetDisplayNameForLocale(language_code
, "en", false);
440 // Only two formats, like "fr" (lower case) and "en-US" (lower-upper), are
441 // allowed. See the text file for details.
442 EXPECT_TRUE(language_code
== "fil" || language_code
.length() == 2 ||
443 (language_code
.length() == 5 && language_code
[2] == '-'))
444 << "Invalid language code " << language_code
;
445 EXPECT_TRUE(l10n_util::IsValidLocaleSyntax(language_code
))
446 << "Invalid language code " << language_code
;
447 EXPECT_FALSE(display_name
.empty())
448 << "Invalid language code " << language_code
;
449 // On error, GetDisplayNameForLocale() returns the |language_code| as-is.
450 EXPECT_NE(language_code
, base::UTF16ToUTF8(display_name
))
451 << "Invalid language code " << language_code
;
455 // Test the input method ID migration.
456 TEST_F(InputMethodUtilTest
, TestInputMethodIDMigration
) {
457 const char* const migration_cases
[][2] = {
458 {"ime:zh:pinyin", "zh-t-i0-pinyin"},
459 {"ime:zh-t:zhuyin", "zh-hant-t-i0-und"},
460 {"ime:zh-t:quick", "zh-hant-t-i0-cangjie-1987-x-m0-simplified"},
461 {"ime:jp:mozc_us", "nacl_mozc_us"},
462 {"ime:ko:hangul", "hangul_2set"},
463 {"m17n:deva_phone", "vkd_deva_phone"},
464 {"m17n:ar", "vkd_ar"},
465 {"t13n:hi", "hi-t-i0-und"},
466 {"unknown", "unknown"},
468 std::vector
<std::string
> input_method_ids
;
469 for (size_t i
= 0; i
< arraysize(migration_cases
); ++i
)
470 input_method_ids
.push_back(migration_cases
[i
][0]);
471 // Duplicated hangul_2set.
472 input_method_ids
.push_back("ime:ko:hangul_2set");
474 util_
.MigrateInputMethods(&input_method_ids
);
476 EXPECT_EQ(arraysize(migration_cases
), input_method_ids
.size());
477 for (size_t i
= 0; i
< arraysize(migration_cases
); ++i
) {
479 extension_ime_util::GetInputMethodIDByEngineID(migration_cases
[i
][1]),
480 input_method_ids
[i
]);
484 // Test getting hardware input method IDs.
485 TEST_F(InputMethodUtilTest
, TestHardwareInputMethodIDs
) {
486 util_
.SetHardwareKeyboardLayoutForTesting("xkb:ru::rus");
487 std::vector
<std::string
> input_method_ids
= util_
.GetHardwareInputMethodIds();
488 std::vector
<std::string
> login_input_method_ids
=
489 util_
.GetHardwareLoginInputMethodIds();
491 EXPECT_EQ(2U, input_method_ids
.size());
492 EXPECT_EQ(1U, login_input_method_ids
.size());
494 EXPECT_EQ("xkb:us::eng", extension_ime_util::GetComponentIDByInputMethodID(
495 input_method_ids
[0]));
496 EXPECT_EQ("xkb:ru::rus", extension_ime_util::GetComponentIDByInputMethodID(
497 input_method_ids
[1]));
498 EXPECT_EQ("xkb:us::eng", extension_ime_util::GetComponentIDByInputMethodID(
499 login_input_method_ids
[0]));
502 } // namespace input_method
503 } // namespace chromeos