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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/debugger.h" | 14 #include "base/debug/debugger.h" |
15 #include "base/debug/profiler.h" | 15 #include "base/debug/profiler.h" |
16 #include "base/debug/stack_trace.h" | 16 #include "base/debug/stack_trace.h" |
17 #include "base/feature_list.h" | 17 #include "base/feature_list.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
20 #include "base/i18n/icu_util.h" | 20 #include "base/i18n/icu_util.h" |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
24 #include "base/path_service.h" | 24 #include "base/path_service.h" |
25 #include "base/process/launch.h" | 25 #include "base/process/launch.h" |
26 #include "base/process/memory.h" | 26 #include "base/process/memory.h" |
27 #include "base/test/gtest_xml_unittest_result_printer.h" | 27 #include "base/test/gtest_xml_unittest_result_printer.h" |
28 #include "base/test/gtest_xml_util.h" | 28 #include "base/test/gtest_xml_util.h" |
| 29 #include "base/test/icu_test_util.h" |
29 #include "base/test/launcher/unit_test_launcher.h" | 30 #include "base/test/launcher/unit_test_launcher.h" |
30 #include "base/test/multiprocess_test.h" | 31 #include "base/test/multiprocess_test.h" |
31 #include "base/test/test_switches.h" | 32 #include "base/test/test_switches.h" |
32 #include "base/test/test_timeouts.h" | 33 #include "base/test/test_timeouts.h" |
33 #include "base/time/time.h" | 34 #include "base/time/time.h" |
34 #include "build/build_config.h" | 35 #include "build/build_config.h" |
35 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
37 #include "testing/multiprocess_func_list.h" | 38 #include "testing/multiprocess_func_list.h" |
38 | 39 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 #endif // defined(OS_WIN) | 343 #endif // defined(OS_WIN) |
343 | 344 |
344 // In some cases, we do not want to see standard error dialogs. | 345 // In some cases, we do not want to see standard error dialogs. |
345 if (!debug::BeingDebugged() && | 346 if (!debug::BeingDebugged() && |
346 !CommandLine::ForCurrentProcess()->HasSwitch("show-error-dialogs")) { | 347 !CommandLine::ForCurrentProcess()->HasSwitch("show-error-dialogs")) { |
347 SuppressErrorDialogs(); | 348 SuppressErrorDialogs(); |
348 debug::SetSuppressDebugUI(true); | 349 debug::SetSuppressDebugUI(true); |
349 logging::SetLogAssertHandler(UnitTestAssertHandler); | 350 logging::SetLogAssertHandler(UnitTestAssertHandler); |
350 } | 351 } |
351 | 352 |
352 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 353 base::test::InitializeICUForTesting(); |
353 switches::kTestDoNotInitializeIcu)) { | 354 |
354 i18n::InitializeICU(); | |
355 } | |
356 // On the Mac OS X command line, the default locale is *_POSIX. In Chromium, | 355 // On the Mac OS X command line, the default locale is *_POSIX. In Chromium, |
357 // the locale is set via an OS X locale API and is never *_POSIX. | 356 // the locale is set via an OS X locale API and is never *_POSIX. |
358 // Some tests (such as those involving word break iterator) will behave | 357 // Some tests (such as those involving word break iterator) will behave |
359 // differently and fail if we use *POSIX locale. Setting it to en_US here | 358 // differently and fail if we use *POSIX locale. Setting it to en_US here |
360 // does not affect tests that explicitly overrides the locale for testing. | 359 // does not affect tests that explicitly overrides the locale for testing. |
361 // This can be an issue on all platforms other than Windows. | 360 // This can be an issue on all platforms other than Windows. |
362 // TODO(jshin): Should we set the locale via an OS X locale API here? | 361 // TODO(jshin): Should we set the locale via an OS X locale API here? |
363 #if !defined(OS_WIN) | 362 #if !defined(OS_WIN) |
364 #if defined(OS_IOS) | 363 #if defined(OS_IOS) |
365 i18n::SetICUDefaultLocale("en_US"); | 364 i18n::SetICUDefaultLocale("en_US"); |
(...skipping 17 matching lines...) Expand all Loading... |
383 | 382 |
384 void TestSuite::Shutdown() { | 383 void TestSuite::Shutdown() { |
385 base::debug::StopProfiling(); | 384 base::debug::StopProfiling(); |
386 | 385 |
387 // Clear the FeatureList that was created by Initialize(). | 386 // Clear the FeatureList that was created by Initialize(). |
388 if (created_feature_list_) | 387 if (created_feature_list_) |
389 FeatureList::ClearInstanceForTesting(); | 388 FeatureList::ClearInstanceForTesting(); |
390 } | 389 } |
391 | 390 |
392 } // namespace base | 391 } // namespace base |
OLD | NEW |