diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 11:07:00 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 11:07:00 +0000 |
commit | ddbee737bbde09572a9f4aecb289551ee673a29c (patch) | |
tree | 94c74d761d3460a77bf218b4a51de93837a84b5e | |
parent | 172ed3dc6f7deaffbba342236ae51340516039a7 (diff) | |
download | chromium_src-ddbee737bbde09572a9f4aecb289551ee673a29c.zip chromium_src-ddbee737bbde09572a9f4aecb289551ee673a29c.tar.gz chromium_src-ddbee737bbde09572a9f4aecb289551ee673a29c.tar.bz2 |
Fix a bug where we were showing incorrect input method display names.
This bug was introduced by
http://src.chromium.org/viewvc/chrome?view=rev&revision=73126
TEST=confirm that the display names are fixed. Added a test for this.
BUG=chromium-os:11575
Review URL: http://codereview.chromium.org/6312086
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73447 0039d316-1c4b-4281-b951-d872f2087c98
3 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index 7f722bb..cb579fb 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -468,11 +468,10 @@ std::string GetKeyboardLayoutName(const std::string& input_method_id) { std::string GetInputMethodDisplayNameFromId( const std::string& input_method_id) { - static const char kDefaultDisplayName[] = "USA"; InputMethodIdToDescriptorMap::const_iterator iter = IdMaps::GetInstance()->id_to_descriptor->find(input_method_id); return (iter == IdMaps::GetInstance()->id_to_descriptor->end()) ? - kDefaultDisplayName : iter->second.display_name; + "" : GetStringUTF8(iter->second.display_name); } const chromeos::InputMethodDescriptor* GetInputMethodDescriptorFromId( diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h index 462cfcf..5818c6c 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.h +++ b/chrome/browser/chromeos/input_method/input_method_util.h @@ -95,7 +95,7 @@ std::string GetLanguageCodeFromInputMethodId( const std::string& input_method_id); // Converts an input method ID to a display name of the IME. Returns -// "USA" (US keyboard) when |input_method_id| is unknown. +// an empty strng when |input_method_id| is unknown. // Examples: "pinyin" => "Pinyin" // "m17n:ar:kbd" => "kbd (m17n)" std::string GetInputMethodDisplayNameFromId(const std::string& input_method_id); diff --git a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc index 0670c44..6cad62e 100644 --- a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc +++ b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc @@ -102,7 +102,10 @@ TEST(InputMethodUtilTest, GetLanguageCodeFromInputMethodId) { } TEST(InputMethodUtilTest, GetInputMethodDisplayNameFromId) { - EXPECT_EQ("Pinyin", GetInputMethodDisplayNameFromId("pinyin")); + EXPECT_EQ("Pinyin input method", GetInputMethodDisplayNameFromId("pinyin")); + EXPECT_EQ("English (United States)", + GetInputMethodDisplayNameFromId("xkb:us::eng")); + EXPECT_EQ("", GetInputMethodDisplayNameFromId("nonexistent")); } TEST(InputMethodUtilTest, GetInputMethodDescriptorFromId) { |