| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2007 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 // | 10 // |
| 11 // A reuseable entry point for gunit tests. | 11 // A reuseable entry point for gunit tests. |
| 12 | 12 |
| 13 #if defined(WEBRTC_WIN) | 13 #if defined(WEBRTC_WIN) |
| 14 #include <crtdbg.h> | 14 #include <crtdbg.h> |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #include "webrtc/base/flags.h" | 17 #include "webrtc/base/flags.h" |
| 18 #include "webrtc/base/fileutils.h" | 18 #include "webrtc/base/fileutils.h" |
| 19 #include "webrtc/base/gunit.h" | 19 #include "webrtc/base/gunit.h" |
| 20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/ssladapter.h" | 21 #include "webrtc/base/ssladapter.h" |
| 22 #include "webrtc/base/sslstreamadapter.h" |
| 22 #include "webrtc/test/field_trial.h" | 23 #include "webrtc/test/field_trial.h" |
| 23 #include "webrtc/test/testsupport/fileutils.h" | 24 #include "webrtc/test/testsupport/fileutils.h" |
| 24 | 25 |
| 25 DEFINE_bool(help, false, "prints this message"); | 26 DEFINE_bool(help, false, "prints this message"); |
| 26 DEFINE_string(log, "", "logging options to use"); | 27 DEFINE_string(log, "", "logging options to use"); |
| 27 DEFINE_string( | 28 DEFINE_string( |
| 28 force_fieldtrials, | 29 force_fieldtrials, |
| 29 "", | 30 "", |
| 30 "Field trials control experimental feature code which can be forced. " | 31 "Field trials control experimental feature code which can be forced. " |
| 31 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | 32 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (*FLAG_log != '\0') { | 97 if (*FLAG_log != '\0') { |
| 97 rtc::LogMessage::ConfigureLogging(FLAG_log); | 98 rtc::LogMessage::ConfigureLogging(FLAG_log); |
| 98 } else if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) { | 99 } else if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) { |
| 99 // Default to LS_INFO, even for release builds to provide better test | 100 // Default to LS_INFO, even for release builds to provide better test |
| 100 // logging. | 101 // logging. |
| 101 rtc::LogMessage::LogToDebug(rtc::LS_INFO); | 102 rtc::LogMessage::LogToDebug(rtc::LS_INFO); |
| 102 } | 103 } |
| 103 | 104 |
| 104 // Initialize SSL which are used by several tests. | 105 // Initialize SSL which are used by several tests. |
| 105 rtc::InitializeSSL(); | 106 rtc::InitializeSSL(); |
| 107 rtc::SSLStreamAdapter::enable_time_callback_for_testing(); |
| 106 | 108 |
| 107 int res = RUN_ALL_TESTS(); | 109 int res = RUN_ALL_TESTS(); |
| 108 | 110 |
| 109 rtc::CleanupSSL(); | 111 rtc::CleanupSSL(); |
| 110 | 112 |
| 111 // clean up logging so we don't appear to leak memory. | 113 // clean up logging so we don't appear to leak memory. |
| 112 rtc::LogMessage::ConfigureLogging(""); | 114 rtc::LogMessage::ConfigureLogging(""); |
| 113 | 115 |
| 114 #if defined(WEBRTC_WIN) | 116 #if defined(WEBRTC_WIN) |
| 115 // Unhook crt function so that we don't ever log after statics have been | 117 // Unhook crt function so that we don't ever log after statics have been |
| 116 // uninitialized. | 118 // uninitialized. |
| 117 if (!FLAG_default_error_handlers) | 119 if (!FLAG_default_error_handlers) |
| 118 _CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, TestCrtReportHandler); | 120 _CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, TestCrtReportHandler); |
| 119 #endif | 121 #endif |
| 120 | 122 |
| 121 return res; | 123 return res; |
| 122 } | 124 } |
| OLD | NEW |