summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:24:17 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:24:17 +0000
commitc535a312073f7fc4eaed7e5efa3d0ef3df2e1dce (patch)
tree41ca5425625303eff2bbe89e704d2aff281af313 /app
parent25ebbf4a2894b6b60350cf22740a0ba7ad9ee7c3 (diff)
downloadchromium_src-c535a312073f7fc4eaed7e5efa3d0ef3df2e1dce.zip
chromium_src-c535a312073f7fc4eaed7e5efa3d0ef3df2e1dce.tar.gz
chromium_src-c535a312073f7fc4eaed7e5efa3d0ef3df2e1dce.tar.bz2
Put tests that depend on the application language pref into an
TBR=jshin Review URL: http://codereview.chromium.org/155933 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/l10n_util_unittest.cc47
1 files changed, 26 insertions, 21 deletions
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc
index 2ac9530..6906983 100644
--- a/app/l10n_util_unittest.cc
+++ b/app/l10n_util_unittest.cc
@@ -97,7 +97,7 @@ void SetICUDefaultLocale(const std::string& locale_string) {
// The meaning of that API, on the Mac, is "the locale used by Cocoa's main
// nib file", which clearly can't be stubbed by a test app that doesn't use
// Cocoa.
-TEST_F(L10nUtilTest, DISABLED_GetAppLocale) {
+TEST_F(L10nUtilTest, GetAppLocale) {
// Use a temporary locale dir so we don't have to actually build the locale
// dlls for this test.
FilePath orig_locale_dir;
@@ -148,27 +148,11 @@ TEST_F(L10nUtilTest, DISABLED_GetAppLocale) {
SetICUDefaultLocale("xx");
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L""));
- SetICUDefaultLocale("en-US");
- EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L"fr"));
- EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L"fr-CA"));
-
- SetICUDefaultLocale("en-US");
- // Aliases iw, no, tl to he, nb, fil.
- EXPECT_EQ("he", l10n_util::GetApplicationLocale(L"iw"));
- EXPECT_EQ("nb", l10n_util::GetApplicationLocale(L"no"));
- EXPECT_EQ("fil", l10n_util::GetApplicationLocale(L"tl"));
- // es-419 and es-XX (where XX is not Spain) should be
- // mapped to es-419 (Latin American Spanish).
- EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(L"es-419"));
- EXPECT_EQ("es", l10n_util::GetApplicationLocale(L"es-ES"));
- EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(L"es-AR"));
-
SetICUDefaultLocale("es-MX");
EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(L""));
SetICUDefaultLocale("es-AR");
EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(L""));
- EXPECT_EQ("es", l10n_util::GetApplicationLocale(L"es"));
SetICUDefaultLocale("es-ES");
EXPECT_EQ("es", l10n_util::GetApplicationLocale(L""));
@@ -178,7 +162,6 @@ TEST_F(L10nUtilTest, DISABLED_GetAppLocale) {
SetICUDefaultLocale("zh-HK");
EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale(L""));
- EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(L"zh-CN"));
SetICUDefaultLocale("zh-MK");
EXPECT_EQ("zh-TW", l10n_util::GetApplicationLocale(L""));
@@ -186,10 +169,32 @@ TEST_F(L10nUtilTest, DISABLED_GetAppLocale) {
SetICUDefaultLocale("zh-SG");
EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(L""));
+#if defined(OS_WIN)
+ // We don't allow user prefs for locale on linux/mac.
+ SetICUDefaultLocale("en-US");
+ EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L"fr"));
+ EXPECT_EQ("fr", l10n_util::GetApplicationLocale(L"fr-CA"));
+
+ SetICUDefaultLocale("en-US");
+ // Aliases iw, no, tl to he, nb, fil.
+ EXPECT_EQ("he", l10n_util::GetApplicationLocale(L"iw"));
+ EXPECT_EQ("nb", l10n_util::GetApplicationLocale(L"no"));
+ EXPECT_EQ("fil", l10n_util::GetApplicationLocale(L"tl"));
+ // es-419 and es-XX (where XX is not Spain) should be
+ // mapped to es-419 (Latin American Spanish).
+ EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(L"es-419"));
+ EXPECT_EQ("es", l10n_util::GetApplicationLocale(L"es-ES"));
+ EXPECT_EQ("es-419", l10n_util::GetApplicationLocale(L"es-AR"));
+
+ SetICUDefaultLocale("es-AR");
+ EXPECT_EQ("es", l10n_util::GetApplicationLocale(L"es"));
+
+ SetICUDefaultLocale("zh-HK");
+ EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(L"zh-CN"));
+
SetICUDefaultLocale("he");
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L"en"));
-#if defined(OS_WIN)
// Oriya should be blocked unless OS is Vista or newer.
if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
SetICUDefaultLocale("or");
@@ -202,7 +207,7 @@ TEST_F(L10nUtilTest, DISABLED_GetAppLocale) {
SetICUDefaultLocale("en-GB");
EXPECT_EQ("or", l10n_util::GetApplicationLocale(L"or"));
}
-#endif
+#endif // defined(OS_WIN)
// Clean up.
PathService::Override(app::DIR_LOCALES, orig_locale_dir.ToWStringHack());
@@ -210,7 +215,7 @@ TEST_F(L10nUtilTest, DISABLED_GetAppLocale) {
UErrorCode error_code = U_ZERO_ERROR;
Locale::setDefault(locale, error_code);
}
-#endif
+#endif // defined(OS_WIN) || defined(OS_LINUX)
TEST_F(L10nUtilTest, SortStringsUsingFunction) {
std::vector<StringWrapper*> strings;