| OLD | NEW |
| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 EXPECT_EQ(UTF8ToUTF16("\xe5\x80\x89"), | 136 EXPECT_EQ(UTF8ToUTF16("\xe5\x80\x89"), |
| 137 util_.GetInputMethodShortName(desc)); | 137 util_.GetInputMethodShortName(desc)); |
| 138 } | 138 } |
| 139 { | 139 { |
| 140 InputMethodDescriptor desc = GetDesc("m17n:zh:quick", "us", "zh-TW"); | 140 InputMethodDescriptor desc = GetDesc("m17n:zh:quick", "us", "zh-TW"); |
| 141 EXPECT_EQ(UTF8ToUTF16("\xe9\x80\x9f"), | 141 EXPECT_EQ(UTF8ToUTF16("\xe9\x80\x9f"), |
| 142 util_.GetInputMethodShortName(desc)); | 142 util_.GetInputMethodShortName(desc)); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 TEST_F(InputMethodUtilTest, GetInputMethodMediumNameTest) { |
| 147 { |
| 148 string16 japanese = UTF8ToUTF16("\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"); |
| 149 const char* input_method_id[] = |
| 150 { "mozc", "mozc-dv", "mozc-jp", "zinnia-japanese", }; |
| 151 const int len = ARRAYSIZE_UNSAFE(input_method_id); |
| 152 for (int i=0; i<len; ++i) { |
| 153 InputMethodDescriptor desc = GetDesc(input_method_id[i], "", ""); |
| 154 string16 medium_name = util_.GetInputMethodMediumName(desc); |
| 155 EXPECT_EQ(japanese,medium_name); |
| 156 } |
| 157 } |
| 158 { |
| 159 InputMethodDescriptor desc = GetDesc("xkb:us::eng", "", ""); |
| 160 string16 medium_name = util_.GetInputMethodMediumName(desc); |
| 161 string16 short_name = util_.GetInputMethodShortName(desc); |
| 162 EXPECT_EQ(medium_name,short_name); |
| 163 } |
| 164 } |
| 165 |
| 146 TEST_F(InputMethodUtilTest, GetInputMethodLongNameTest) { | 166 TEST_F(InputMethodUtilTest, GetInputMethodLongNameTest) { |
| 147 // For most languages input method or keyboard layout name is returned. | 167 // For most languages input method or keyboard layout name is returned. |
| 148 // See below for exceptions. | 168 // See below for exceptions. |
| 149 { | 169 { |
| 150 InputMethodDescriptor desc = GetDesc("m17n:fa:isiri", "us", "fa"); | 170 InputMethodDescriptor desc = GetDesc("m17n:fa:isiri", "us", "fa"); |
| 151 EXPECT_EQ(ASCIIToUTF16("Persian input method (ISIRI 2901 layout)"), | 171 EXPECT_EQ(ASCIIToUTF16("Persian input method (ISIRI 2901 layout)"), |
| 152 util_.GetInputMethodLongName(desc)); | 172 util_.GetInputMethodLongName(desc)); |
| 153 } | 173 } |
| 154 { | 174 { |
| 155 InputMethodDescriptor desc = GetDesc("mozc-hangul", "us", "ko"); | 175 InputMethodDescriptor desc = GetDesc("mozc-hangul", "us", "ko"); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 EXPECT_FALSE(display_name.empty()) | 541 EXPECT_FALSE(display_name.empty()) |
| 522 << "Invalid language code " << language_code; | 542 << "Invalid language code " << language_code; |
| 523 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. | 543 // On error, GetDisplayNameForLocale() returns the |language_code| as-is. |
| 524 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) | 544 EXPECT_NE(language_code, UTF16ToUTF8(display_name)) |
| 525 << "Invalid language code " << language_code; | 545 << "Invalid language code " << language_code; |
| 526 } | 546 } |
| 527 } | 547 } |
| 528 | 548 |
| 529 } // namespace input_method | 549 } // namespace input_method |
| 530 } // namespace chromeos | 550 } // namespace chromeos |
| OLD | NEW |