Index: ui/base/l10n/l10n_util_unittest.cc |
diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc |
index 971d7ce605afe71b04dcbc184fdd1c1ca4185a74..0f22342096be45387c587a231e8f41fa143b3b5d 100644 |
--- a/ui/base/l10n/l10n_util_unittest.cc |
+++ b/ui/base/l10n/l10n_util_unittest.cc |
@@ -303,7 +303,7 @@ TEST_F(L10nUtilTest, SortStringsUsingFunction) { |
STLDeleteElements(&strings); |
} |
-TEST_F(L10nUtilTest, LocaleDisplayName) { |
+TEST_F(L10nUtilTest, GetDisplayNameForLocale) { |
// TODO(jungshik): Make this test more extensive. |
// Test zh-CN and zh-TW are treated as zh-Hans and zh-Hant. |
string16 result = l10n_util::GetDisplayNameForLocale("zh-CN", "en", false); |
@@ -318,6 +318,12 @@ TEST_F(L10nUtilTest, LocaleDisplayName) { |
result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); |
EXPECT_EQ(ASCIIToUTF16("Spanish (Latin America)"), result); |
+ result = l10n_util::GetDisplayNameForLocale("-BR", "en", false); |
+ EXPECT_EQ(ASCIIToUTF16("Brazil"), result); |
+ |
+ result = l10n_util::GetDisplayNameForLocale("xyz-xyz", "en", false); |
+ EXPECT_EQ(ASCIIToUTF16("xyz (XYZ)"), result); |
+ |
// ToUpper and ToLower should work with embedded NULLs. |
const size_t length_with_null = 4; |
char16 buf_with_null[length_with_null] = { 0, 'a', 0, 'b' }; |
@@ -334,6 +340,17 @@ TEST_F(L10nUtilTest, LocaleDisplayName) { |
lower_with_null[2] == 0 && lower_with_null[3] == 'b'); |
} |
+TEST_F(L10nUtilTest, GetDisplayNameForCountry) { |
+ string16 result = l10n_util::GetDisplayNameForCountry("BR", "en"); |
+ EXPECT_EQ(ASCIIToUTF16("Brazil"), result); |
+ |
+ result = l10n_util::GetDisplayNameForCountry("419", "en"); |
+ EXPECT_EQ(ASCIIToUTF16("Latin America"), result); |
+ |
+ result = l10n_util::GetDisplayNameForCountry("xyz", "en"); |
+ EXPECT_EQ(ASCIIToUTF16("XYZ"), result); |
+} |
+ |
TEST_F(L10nUtilTest, GetParentLocales) { |
std::vector<std::string> locales; |
const std::string top_locale("sr_Cyrl_RS"); |