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 | |
46 #if defined(OS_ANDROID) | 38 #if defined(OS_ANDROID) |
47 #include "base/test/test_support_android.h" | 39 #include "base/test/test_support_android.h" |
48 #endif | 40 #endif |
49 | 41 |
50 #if defined(OS_IOS) | 42 #if defined(OS_IOS) |
51 #include "base/test/test_support_ios.h" | 43 #include "base/test/test_support_ios.h" |
52 #endif | 44 #endif |
53 | 45 |
54 namespace { | 46 namespace { |
55 | 47 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // In some cases, we do not want to see standard error dialogs. | 314 // In some cases, we do not want to see standard error dialogs. |
323 if (!base::debug::BeingDebugged() && | 315 if (!base::debug::BeingDebugged() && |
324 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 316 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
325 "show-error-dialogs")) { | 317 "show-error-dialogs")) { |
326 SuppressErrorDialogs(); | 318 SuppressErrorDialogs(); |
327 base::debug::SetSuppressDebugUI(true); | 319 base::debug::SetSuppressDebugUI(true); |
328 logging::SetLogAssertHandler(UnitTestAssertHandler); | 320 logging::SetLogAssertHandler(UnitTestAssertHandler); |
329 } | 321 } |
330 | 322 |
331 base::i18n::InitializeICU(); | 323 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 | |
348 | 324 |
349 CatchMaybeTests(); | 325 CatchMaybeTests(); |
350 ResetCommandLine(); | 326 ResetCommandLine(); |
351 AddTestLauncherResultPrinter(); | 327 AddTestLauncherResultPrinter(); |
352 | 328 |
353 TestTimeouts::Initialize(); | 329 TestTimeouts::Initialize(); |
354 | 330 |
355 trace_to_file_.BeginTracingFromCommandLineOptions(); | 331 trace_to_file_.BeginTracingFromCommandLineOptions(); |
356 } | 332 } |
357 | 333 |
358 void TestSuite::Shutdown() { | 334 void TestSuite::Shutdown() { |
359 } | 335 } |
OLD | NEW |