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

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

Issue 10825007: Fix the failed case L10nUtilTest.GetAppLocale of ui unittests on Android (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebase Created 8 years, 4 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 | « build/android/gtest_filter/ui_unittests_disabled ('k') | no next file » | 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 a9b51fd460aa60a16010bbe78fdf4476c4e1561d..6395a8ea68641ee11b5fc28099b07598d23edd41 100644
--- a/ui/base/l10n/l10n_util_unittest.cc
+++ b/ui/base/l10n/l10n_util_unittest.cc
@@ -74,7 +74,7 @@ TEST_F(L10nUtilTest, DISABLED_GetString) {
// Cocoa.
void SetDefaultLocaleForTest(const std::string& tag, base::Environment* env) {
-#if defined(OS_POSIX) && !defined(OS_CHROMEOS)
+#if defined(OS_POSIX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
env->SetVar("LANGUAGE", tag);
#else
base::i18n::SetICUDefaultLocale(tag);
@@ -118,7 +118,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
// Keep a copy of ICU's default locale before we overwrite it.
icu::Locale locale = icu::Locale::getDefault();
-#if defined(OS_POSIX) && !defined(OS_CHROMEOS)
+#if defined(OS_POSIX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
env.reset(base::Environment::Create());
// Test the support of LANGUAGE environment variable.
@@ -170,7 +170,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
SetDefaultLocaleForTest("ca_ES.UTF8@valencia", env.get());
EXPECT_EQ("ca@valencia", l10n_util::GetApplicationLocale(""));
-#endif // defined(OS_POSIX) && !defined(OS_CHROMEOS)
+#endif // defined(OS_POSIX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
SetDefaultLocaleForTest("en-US", env.get());
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(""));
@@ -178,9 +178,10 @@ TEST_F(L10nUtilTest, GetAppLocale) {
SetDefaultLocaleForTest("xx", env.get());
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(""));
-#if defined(OS_CHROMEOS)
- // ChromeOS honors preferred locale first in GetApplicationLocale(),
- // defaulting to en-US, while other targets first honor other signals.
+#if defined(OS_CHROMEOS) || defined(OS_ANDROID)
+ // ChromeOS and Android honor preferred locale first in
+ // GetApplicationLocale(), defaulting to en-US, while other
+ // targets first honor other signals.
base::i18n::SetICUDefaultLocale("en-GB");
EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(""));
@@ -198,7 +199,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
base::i18n::SetICUDefaultLocale("en-US");
EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale("en-ZA"));
-#else // defined(OS_CHROMEOS)
+#else // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
SetDefaultLocaleForTest("en-GB", env.get());
EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(""));
@@ -237,7 +238,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
SetDefaultLocaleForTest("en-ZA", env.get());
EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(""));
-#endif // defined (OS_CHROMEOS)
+#endif // defined (OS_CHROMEOS) || defined(OS_ANDROID)
#if defined(OS_WIN)
// We don't allow user prefs for locale on linux/mac.
« no previous file with comments | « build/android/gtest_filter/ui_unittests_disabled ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698