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

Unified Diff: ui/base/l10n/l10n_util_unittest.cc

Issue 10310029: Reapply "Changes according to review comments" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use StartsWith Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | ui/ui_unittests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « ui/base/l10n/l10n_util.cc ('k') | ui/ui_unittests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698