| 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/test/field_trial.h" | 22 #include "webrtc/test/field_trial.h" |
| 23 #include "webrtc/test/testsupport/fileutils.h" |
| 23 | 24 |
| 24 DEFINE_bool(help, false, "prints this message"); | 25 DEFINE_bool(help, false, "prints this message"); |
| 25 DEFINE_string(log, "", "logging options to use"); | 26 DEFINE_string(log, "", "logging options to use"); |
| 26 DEFINE_string( | 27 DEFINE_string( |
| 27 force_fieldtrials, | 28 force_fieldtrials, |
| 28 "", | 29 "", |
| 29 "Field trials control experimental feature code which can be forced. " | 30 "Field trials control experimental feature code which can be forced. " |
| 30 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | 31 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 31 " will assign the group Enable to field trial WebRTC-FooFeature."); | 32 " will assign the group Enable to field trial WebRTC-FooFeature."); |
| 32 #if defined(WEBRTC_WIN) | 33 #if defined(WEBRTC_WIN) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 61 #endif // WEBRTC_WIN | 62 #endif // WEBRTC_WIN |
| 62 | 63 |
| 63 int main(int argc, char** argv) { | 64 int main(int argc, char** argv) { |
| 64 testing::InitGoogleTest(&argc, argv); | 65 testing::InitGoogleTest(&argc, argv); |
| 65 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false); | 66 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false); |
| 66 if (FLAG_help) { | 67 if (FLAG_help) { |
| 67 rtc::FlagList::Print(NULL, false); | 68 rtc::FlagList::Print(NULL, false); |
| 68 return 0; | 69 return 0; |
| 69 } | 70 } |
| 70 | 71 |
| 72 webrtc::test::SetExecutablePath(argv[0]); |
| 71 webrtc::test::InitFieldTrialsFromString(FLAG_force_fieldtrials); | 73 webrtc::test::InitFieldTrialsFromString(FLAG_force_fieldtrials); |
| 72 | 74 |
| 73 #if defined(WEBRTC_WIN) | 75 #if defined(WEBRTC_WIN) |
| 74 if (!FLAG_default_error_handlers) { | 76 if (!FLAG_default_error_handlers) { |
| 75 // Make sure any errors don't throw dialogs hanging the test run. | 77 // Make sure any errors don't throw dialogs hanging the test run. |
| 76 _set_invalid_parameter_handler(TestInvalidParameterHandler); | 78 _set_invalid_parameter_handler(TestInvalidParameterHandler); |
| 77 _set_purecall_handler(TestPureCallHandler); | 79 _set_purecall_handler(TestPureCallHandler); |
| 78 _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, TestCrtReportHandler); | 80 _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, TestCrtReportHandler); |
| 79 } | 81 } |
| 80 | 82 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 111 | 113 |
| 112 #if defined(WEBRTC_WIN) | 114 #if defined(WEBRTC_WIN) |
| 113 // Unhook crt function so that we don't ever log after statics have been | 115 // Unhook crt function so that we don't ever log after statics have been |
| 114 // uninitialized. | 116 // uninitialized. |
| 115 if (!FLAG_default_error_handlers) | 117 if (!FLAG_default_error_handlers) |
| 116 _CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, TestCrtReportHandler); | 118 _CrtSetReportHook2(_CRT_RPTHOOK_REMOVE, TestCrtReportHandler); |
| 117 #endif | 119 #endif |
| 118 | 120 |
| 119 return res; | 121 return res; |
| 120 } | 122 } |
| OLD | NEW |