OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 EXPECT_EQ("ro", GetKeyboardOverlayId("xkb:ro::rum")); | 205 EXPECT_EQ("ro", GetKeyboardOverlayId("xkb:ro::rum")); |
206 EXPECT_EQ("sv", GetKeyboardOverlayId("xkb:se::swe")); | 206 EXPECT_EQ("sv", GetKeyboardOverlayId("xkb:se::swe")); |
207 EXPECT_EQ("sk", GetKeyboardOverlayId("xkb:sk::slo")); | 207 EXPECT_EQ("sk", GetKeyboardOverlayId("xkb:sk::slo")); |
208 EXPECT_EQ("sl", GetKeyboardOverlayId("xkb:si::slv")); | 208 EXPECT_EQ("sl", GetKeyboardOverlayId("xkb:si::slv")); |
209 EXPECT_EQ("sr", GetKeyboardOverlayId("xkb:rs::srp")); | 209 EXPECT_EQ("sr", GetKeyboardOverlayId("xkb:rs::srp")); |
210 EXPECT_EQ("tr", GetKeyboardOverlayId("xkb:tr::tur")); | 210 EXPECT_EQ("tr", GetKeyboardOverlayId("xkb:tr::tur")); |
211 EXPECT_EQ("uk", GetKeyboardOverlayId("xkb:ua::ukr")); | 211 EXPECT_EQ("uk", GetKeyboardOverlayId("xkb:ua::ukr")); |
212 } | 212 } |
213 | 213 |
214 TEST(InputMethodUtilTest, GetLanguageDisplayNameFromCode) { | 214 TEST(InputMethodUtilTest, GetLanguageDisplayNameFromCode) { |
215 EXPECT_EQ(L"Finnish", GetLanguageDisplayNameFromCode("fi")); | 215 EXPECT_EQ(UTF8ToUTF16("Finnish"), GetLanguageDisplayNameFromCode("fi")); |
216 } | 216 } |
217 | 217 |
218 TEST(InputMethodUtilTest, GetLanguageNativeDisplayNameFromCode) { | 218 TEST(InputMethodUtilTest, GetLanguageNativeDisplayNameFromCode) { |
219 EXPECT_EQ(L"suomi", GetLanguageNativeDisplayNameFromCode("fi")); | 219 EXPECT_EQ(UTF8ToUTF16("suomi"), GetLanguageNativeDisplayNameFromCode("fi")); |
220 } | 220 } |
221 | 221 |
222 TEST(InputMethodUtilTest, SortLanguageCodesByNames) { | 222 TEST(InputMethodUtilTest, SortLanguageCodesByNames) { |
223 std::vector<std::string> language_codes; | 223 std::vector<std::string> language_codes; |
224 // Check if this function can handle an empty list. | 224 // Check if this function can handle an empty list. |
225 SortLanguageCodesByNames(&language_codes); | 225 SortLanguageCodesByNames(&language_codes); |
226 | 226 |
227 language_codes.push_back("ja"); | 227 language_codes.push_back("ja"); |
228 language_codes.push_back("fr"); | 228 language_codes.push_back("fr"); |
229 // For "t", see the comment in NormalizeLanguageCode test. | 229 // For "t", see the comment in NormalizeLanguageCode test. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EXPECT_EQ("xkb:fr:fra", result[0]); | 310 EXPECT_EQ("xkb:fr:fra", result[0]); |
311 | 311 |
312 EXPECT_FALSE(GetInputMethodIdsFromLanguageCodeInternal( | 312 EXPECT_FALSE(GetInputMethodIdsFromLanguageCodeInternal( |
313 language_code_to_ids_map, "invalid_lang", kAllInputMethods, &result)); | 313 language_code_to_ids_map, "invalid_lang", kAllInputMethods, &result)); |
314 EXPECT_FALSE(GetInputMethodIdsFromLanguageCodeInternal( | 314 EXPECT_FALSE(GetInputMethodIdsFromLanguageCodeInternal( |
315 language_code_to_ids_map, "invalid_lang", kKeyboardLayoutsOnly, &result)); | 315 language_code_to_ids_map, "invalid_lang", kKeyboardLayoutsOnly, &result)); |
316 } | 316 } |
317 | 317 |
318 } // namespace input_method | 318 } // namespace input_method |
319 } // namespace chromeos | 319 } // namespace chromeos |
OLD | NEW |