summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authoryongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-07 04:00:12 +0000
committeryongsheng.zhu@intel.com <yongsheng.zhu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-07 04:00:12 +0000
commit0691d3b88dff21e2492974616673d1172b46faf7 (patch)
tree6e2ff8524bf845142355333c0365240030cb2cf3 /ui
parentebfa609289ea5b991b4dc3105bc04cdaf689edb0 (diff)
downloadchromium_src-0691d3b88dff21e2492974616673d1172b46faf7.zip
chromium_src-0691d3b88dff21e2492974616673d1172b46faf7.tar.gz
chromium_src-0691d3b88dff21e2492974616673d1172b46faf7.tar.bz2
Fix the failed case L10nUtilTest.GetAppLocale of ui unittests on Android
There are 2 kinds of issues to make it failed: 1) pak files are stored in a different directory on Android other than other platforms. 2) The setting and getting locale is different from Linux, but similar with ChromiumOS. BUG= TEST=run_tests.py -s ui_unittests Review URL: https://chromiumcodereview.appspot.com/10825007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/l10n/l10n_util_unittest.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc
index a9b51fd..6395a8e 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.