OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/test/test_suite.h" | 5 #include "base/test/test_suite.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 #include "testing/multiprocess_func_list.h" | 29 #include "testing/multiprocess_func_list.h" |
30 | 30 |
31 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
32 #include "base/mac/scoped_nsautorelease_pool.h" | 32 #include "base/mac/scoped_nsautorelease_pool.h" |
33 #if defined(OS_IOS) | 33 #if defined(OS_IOS) |
34 #include "base/test/test_listener_ios.h" | 34 #include "base/test/test_listener_ios.h" |
35 #endif // OS_IOS | 35 #endif // OS_IOS |
36 #endif // OS_MACOSX | 36 #endif // OS_MACOSX |
37 | 37 |
| 38 #if !defined(OS_WIN) |
| 39 #include "base/i18n/rtl.h" |
| 40 #if !defined(OS_IOS) |
| 41 #include "base/strings/string_util.h" |
| 42 #include "third_party/icu/source/common/unicode/uloc.h" |
| 43 #endif |
| 44 #endif |
| 45 |
38 #if defined(OS_ANDROID) | 46 #if defined(OS_ANDROID) |
39 #include "base/test/test_support_android.h" | 47 #include "base/test/test_support_android.h" |
40 #endif | 48 #endif |
41 | 49 |
42 #if defined(OS_IOS) | 50 #if defined(OS_IOS) |
43 #include "base/test/test_support_ios.h" | 51 #include "base/test/test_support_ios.h" |
44 #endif | 52 #endif |
45 | 53 |
46 namespace { | 54 namespace { |
47 | 55 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // In some cases, we do not want to see standard error dialogs. | 322 // In some cases, we do not want to see standard error dialogs. |
315 if (!base::debug::BeingDebugged() && | 323 if (!base::debug::BeingDebugged() && |
316 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 324 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
317 "show-error-dialogs")) { | 325 "show-error-dialogs")) { |
318 SuppressErrorDialogs(); | 326 SuppressErrorDialogs(); |
319 base::debug::SetSuppressDebugUI(true); | 327 base::debug::SetSuppressDebugUI(true); |
320 logging::SetLogAssertHandler(UnitTestAssertHandler); | 328 logging::SetLogAssertHandler(UnitTestAssertHandler); |
321 } | 329 } |
322 | 330 |
323 base::i18n::InitializeICU(); | 331 base::i18n::InitializeICU(); |
| 332 // On the Mac OS X command line, the default locale is *_POSIX. In Chromium, |
| 333 // the locale is set via an OS X locale API and is never *_POSIX. |
| 334 // Some tests (such as those involving word break iterator) will behave |
| 335 // differently and fail if we use *POSIX locale. Setting it to en_US here |
| 336 // does not affect tests that explicitly overrides the locale for testing. |
| 337 // This can be an issue on all platforms other than Windows. |
| 338 // TODO(jshin): Should we set the locale via an OS X locale API here? |
| 339 #if !defined(OS_WIN) |
| 340 #if defined(OS_IOS) |
| 341 base::i18n::SetICUDefaultLocale("en_US"); |
| 342 #else |
| 343 std::string default_locale(uloc_getDefault()); |
| 344 if (EndsWith(default_locale, "POSIX", false)) |
| 345 base::i18n::SetICUDefaultLocale("en_US"); |
| 346 #endif |
| 347 #endif |
324 | 348 |
325 CatchMaybeTests(); | 349 CatchMaybeTests(); |
326 ResetCommandLine(); | 350 ResetCommandLine(); |
327 AddTestLauncherResultPrinter(); | 351 AddTestLauncherResultPrinter(); |
328 | 352 |
329 TestTimeouts::Initialize(); | 353 TestTimeouts::Initialize(); |
330 | 354 |
331 trace_to_file_.BeginTracingFromCommandLineOptions(); | 355 trace_to_file_.BeginTracingFromCommandLineOptions(); |
332 } | 356 } |
333 | 357 |
334 void TestSuite::Shutdown() { | 358 void TestSuite::Shutdown() { |
335 } | 359 } |
OLD | NEW |