Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util_unittest.cc

Issue 17239002: Removes the old ibus based keyboards, and replace them with the ones based on extension IME API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the test failures. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/chromeos/input_method/input_method_util.h" 5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng")); 306 EXPECT_TRUE(InputMethodUtil::IsKeyboardLayout("xkb:us::eng"));
307 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout(pinyin_ime_id)); 307 EXPECT_FALSE(InputMethodUtil::IsKeyboardLayout(pinyin_ime_id));
308 } 308 }
309 309
310 TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) { 310 TEST_F(InputMethodUtilTest, TestGetKeyboardLayoutName) {
311 // Unsupported case. 311 // Unsupported case.
312 EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID")); 312 EXPECT_EQ("", util_.GetKeyboardLayoutName("UNSUPPORTED_ID"));
313 313
314 // Supported cases (samples). 314 // Supported cases (samples).
315 EXPECT_EQ("us", util_.GetKeyboardLayoutName(pinyin_ime_id)); 315 EXPECT_EQ("us", util_.GetKeyboardLayoutName(pinyin_ime_id));
316 EXPECT_EQ("us", util_.GetKeyboardLayoutName("m17n:ar:kbd"));
317 EXPECT_EQ("es", util_.GetKeyboardLayoutName("xkb:es::spa")); 316 EXPECT_EQ("es", util_.GetKeyboardLayoutName("xkb:es::spa"));
318 EXPECT_EQ("es(cat)", util_.GetKeyboardLayoutName("xkb:es:cat:cat")); 317 EXPECT_EQ("es(cat)", util_.GetKeyboardLayoutName("xkb:es:cat:cat"));
319 EXPECT_EQ("gb(extd)", util_.GetKeyboardLayoutName("xkb:gb:extd:eng")); 318 EXPECT_EQ("gb(extd)", util_.GetKeyboardLayoutName("xkb:gb:extd:eng"));
320 EXPECT_EQ("us", util_.GetKeyboardLayoutName("xkb:us::eng")); 319 EXPECT_EQ("us", util_.GetKeyboardLayoutName("xkb:us::eng"));
321 EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName("xkb:us:dvorak:eng")); 320 EXPECT_EQ("us(dvorak)", util_.GetKeyboardLayoutName("xkb:us:dvorak:eng"));
322 EXPECT_EQ("us(colemak)", util_.GetKeyboardLayoutName("xkb:us:colemak:eng")); 321 EXPECT_EQ("us(colemak)", util_.GetKeyboardLayoutName("xkb:us:colemak:eng"));
323 EXPECT_EQ("de(neo)", util_.GetKeyboardLayoutName("xkb:de:neo:ger")); 322 EXPECT_EQ("de(neo)", util_.GetKeyboardLayoutName("xkb:de:neo:ger"));
324 } 323 }
325 324
326 TEST_F(InputMethodUtilTest, TestGetLanguageCodeFromInputMethodId) { 325 TEST_F(InputMethodUtilTest, TestGetLanguageCodeFromInputMethodId) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 440
442 // US keyboard + Thai = US keyboard + kesmanee. 441 // US keyboard + Thai = US keyboard + kesmanee.
443 TEST_F(InputMethodUtilTest, TestGetFirstLoginInputMethodIds_Us_And_Th) { 442 TEST_F(InputMethodUtilTest, TestGetFirstLoginInputMethodIds_Us_And_Th) {
444 const InputMethodDescriptor* descriptor = 443 const InputMethodDescriptor* descriptor =
445 util_.GetInputMethodDescriptorFromId("xkb:us::eng"); // US keyboard. 444 util_.GetInputMethodDescriptorFromId("xkb:us::eng"); // US keyboard.
446 ASSERT_TRUE(NULL != descriptor); // ASSERT_NE doesn't compile. 445 ASSERT_TRUE(NULL != descriptor); // ASSERT_NE doesn't compile.
447 std::vector<std::string> input_method_ids; 446 std::vector<std::string> input_method_ids;
448 util_.GetFirstLoginInputMethodIds("th", *descriptor, &input_method_ids); 447 util_.GetFirstLoginInputMethodIds("th", *descriptor, &input_method_ids);
449 ASSERT_EQ(2U, input_method_ids.size()); 448 ASSERT_EQ(2U, input_method_ids.size());
450 EXPECT_EQ("xkb:us::eng", input_method_ids[0]); 449 EXPECT_EQ("xkb:us::eng", input_method_ids[0]);
451 EXPECT_EQ("m17n:th:kesmanee", input_method_ids[1]); // Kesmanee. 450 EXPECT_EQ("_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_th",
451 input_method_ids[1]); // Kesmanee.
452 } 452 }
453 453
454 // US keyboard + Vietnamese = US keyboard + TCVN6064. 454 // US keyboard + Vietnamese = US keyboard + TCVN6064.
455 TEST_F(InputMethodUtilTest, TestGetFirstLoginInputMethodIds_Us_And_Vi) { 455 TEST_F(InputMethodUtilTest, TestGetFirstLoginInputMethodIds_Us_And_Vi) {
456 const InputMethodDescriptor* descriptor = 456 const InputMethodDescriptor* descriptor =
457 util_.GetInputMethodDescriptorFromId("xkb:us::eng"); // US keyboard. 457 util_.GetInputMethodDescriptorFromId("xkb:us::eng"); // US keyboard.
458 ASSERT_TRUE(NULL != descriptor); // ASSERT_NE doesn't compile. 458 ASSERT_TRUE(NULL != descriptor); // ASSERT_NE doesn't compile.
459 std::vector<std::string> input_method_ids; 459 std::vector<std::string> input_method_ids;
460 util_.GetFirstLoginInputMethodIds("vi", *descriptor, &input_method_ids); 460 util_.GetFirstLoginInputMethodIds("vi", *descriptor, &input_method_ids);
461 ASSERT_EQ(2U, input_method_ids.size()); 461 ASSERT_EQ(2U, input_method_ids.size());
462 EXPECT_EQ("xkb:us::eng", input_method_ids[0]); 462 EXPECT_EQ("xkb:us::eng", input_method_ids[0]);
463 EXPECT_EQ("m17n:vi:tcvn", input_method_ids[1]); // TCVN6064. 463 EXPECT_EQ("_comp_ime_jhffeifommiaekmbkkjlpmilogcfdohpvkd_vi_tcvn",
464 input_method_ids[1]); // TCVN6064.
464 } 465 }
465 466
466 TEST_F(InputMethodUtilTest, TestGetLanguageCodesFromInputMethodIds) { 467 TEST_F(InputMethodUtilTest, TestGetLanguageCodesFromInputMethodIds) {
467 std::vector<std::string> input_method_ids; 468 std::vector<std::string> input_method_ids;
468 input_method_ids.push_back("xkb:us::eng"); // English US. 469 input_method_ids.push_back("xkb:us::eng"); // English US.
469 input_method_ids.push_back("xkb:us:dvorak:eng"); // English US Dvorak. 470 input_method_ids.push_back("xkb:us:dvorak:eng"); // English US Dvorak.
470 input_method_ids.push_back(pinyin_ime_id); // Pinyin 471 input_method_ids.push_back(pinyin_ime_id); // Pinyin
471 input_method_ids.push_back("xkb:fr::fra"); // French France. 472 input_method_ids.push_back("xkb:fr::fra"); // French France.
472 std::vector<std::string> language_codes; 473 std::vector<std::string> language_codes;
473 util_.GetLanguageCodesFromInputMethodIds(input_method_ids, &language_codes); 474 util_.GetLanguageCodesFromInputMethodIds(input_method_ids, &language_codes);
(...skipping 20 matching lines...) Expand all
494 EXPECT_FALSE(display_name.empty()) 495 EXPECT_FALSE(display_name.empty())
495 << "Invalid language code " << language_code; 496 << "Invalid language code " << language_code;
496 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. 497 // On error, GetDisplayNameForLocale() returns the |language_code| as-is.
497 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) 498 EXPECT_NE(language_code, UTF16ToUTF8(display_name))
498 << "Invalid language code " << language_code; 499 << "Invalid language code " << language_code;
499 } 500 }
500 } 501 }
501 502
502 } // namespace input_method 503 } // namespace input_method
503 } // namespace chromeos 504 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_util.cc ('k') | chromeos/ime/input_methods.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698