Chromium Code Reviews| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/debugger.h" | 12 #include "base/debug/debugger.h" |
| 13 #include "base/debug/stack_trace.h" | 13 #include "base/debug/stack_trace.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/i18n/icu_util.h" | 16 #include "base/i18n/icu_util.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/metrics/statistics_recorder.h" | |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/process/memory.h" | 21 #include "base/process/memory.h" |
| 21 #include "base/test/gtest_xml_util.h" | 22 #include "base/test/gtest_xml_util.h" |
| 22 #include "base/test/launcher/unit_test_launcher.h" | 23 #include "base/test/launcher/unit_test_launcher.h" |
| 23 #include "base/test/multiprocess_test.h" | 24 #include "base/test/multiprocess_test.h" |
| 24 #include "base/test/test_switches.h" | 25 #include "base/test/test_switches.h" |
| 25 #include "base/test/test_timeouts.h" | 26 #include "base/test/test_timeouts.h" |
| 26 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 27 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 // Suppress the "Debug Assertion Failed" dialog. | 275 // Suppress the "Debug Assertion Failed" dialog. |
| 275 // TODO(hbono): remove this code when gtest has it. | 276 // TODO(hbono): remove this code when gtest has it. |
| 276 // http://groups.google.com/d/topic/googletestframework/OjuwNlXy5ac/discussion | 277 // http://groups.google.com/d/topic/googletestframework/OjuwNlXy5ac/discussion |
| 277 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); | 278 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); |
| 278 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); | 279 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); |
| 279 #endif // defined(_DEBUG) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 1) | 280 #endif // defined(_DEBUG) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 1) |
| 280 #endif // defined(OS_WIN) | 281 #endif // defined(OS_WIN) |
| 281 } | 282 } |
| 282 | 283 |
| 283 void TestSuite::Initialize() { | 284 void TestSuite::Initialize() { |
| 285 // Record histograms, so we can get histograms data in tests. | |
|
Alexei Svitkine (slow)
2014/06/20 14:41:41
"Record histograms" isn't really accurate.
Instea
manzagop (departed)
2014/06/20 15:13:53
Done.
| |
| 286 base::StatisticsRecorder::Initialize(); | |
| 287 | |
| 284 #if defined(OS_MACOSX) && !defined(OS_IOS) | 288 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 285 // Some of the app unit tests spin runloops. | 289 // Some of the app unit tests spin runloops. |
| 286 mock_cr_app::RegisterMockCrApp(); | 290 mock_cr_app::RegisterMockCrApp(); |
| 287 #endif | 291 #endif |
| 288 | 292 |
| 289 #if defined(OS_IOS) | 293 #if defined(OS_IOS) |
| 290 InitIOSTestMessageLoop(); | 294 InitIOSTestMessageLoop(); |
| 291 #endif // OS_IOS | 295 #endif // OS_IOS |
| 292 | 296 |
| 293 #if defined(OS_ANDROID) | 297 #if defined(OS_ANDROID) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 ResetCommandLine(); | 332 ResetCommandLine(); |
| 329 #if !defined(OS_IOS) | 333 #if !defined(OS_IOS) |
| 330 AddTestLauncherResultPrinter(); | 334 AddTestLauncherResultPrinter(); |
| 331 #endif // !defined(OS_IOS) | 335 #endif // !defined(OS_IOS) |
| 332 | 336 |
| 333 TestTimeouts::Initialize(); | 337 TestTimeouts::Initialize(); |
| 334 } | 338 } |
| 335 | 339 |
| 336 void TestSuite::Shutdown() { | 340 void TestSuite::Shutdown() { |
| 337 } | 341 } |
| OLD | NEW |