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

Unified Diff: base/test/test_suite.cc

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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
Index: base/test/test_suite.cc
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 903e93ea07a7b8aba49e66f49603dcda88bdae89..d40dd983eb6b143fdbf97466ce25e66ec2be92dc 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -35,6 +35,14 @@
#endif // OS_IOS
#endif // OS_MACOSX
+#if !defined(OS_WIN)
+#include "base/i18n/rtl.h"
+#if !defined(OS_IOS)
+#include "base/strings/string_util.h"
+#include "third_party/icu/source/common/unicode/uloc.h"
+#endif
+#endif
+
#if defined(OS_ANDROID)
#include "base/test/test_support_android.h"
#endif
@@ -321,6 +329,22 @@ void TestSuite::Initialize() {
}
base::i18n::InitializeICU();
+ // On the Mac OS X command line, the default locale is *_POSIX. In Chromium,
+ // the locale is set via an OS X locale API and is never *_POSIX.
+ // Some tests (such as those involving word break iterator) will behave
+ // differently and fail if we use *POSIX locale. Setting it to en_US here
+ // does not affect tests that explicitly overrides the locale for testing.
+ // This can be an issue on all platforms other than Windows.
+ // TODO(jshin): Should we set the locale via an OS X locale API here?
+#if !defined(OS_WIN)
+#if defined(OS_IOS)
+ base::i18n::SetICUDefaultLocale("en_US");
+#else
+ std::string default_locale(uloc_getDefault());
+ if (EndsWith(default_locale, "POSIX", false))
+ base::i18n::SetICUDefaultLocale("en_US");
+#endif
+#endif
CatchMaybeTests();
ResetCommandLine();
« no previous file with comments | « base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java ('k') | base/time/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698