pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "rtc_base/flags.h" |
| 12 | #include "rtc_base/logging.h" |
| 13 | #include "system_wrappers/include/metrics_default.h" |
| 14 | #include "test/field_trial.h" |
| 15 | #include "test/gmock.h" |
| 16 | #include "test/gtest.h" |
| 17 | #include "test/testsupport/fileutils.h" |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 18 | |
Kári Tristan Helgason | e2baffb | 2017-06-09 10:31:58 +0200 | [diff] [blame] | 19 | #if defined(WEBRTC_IOS) |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 20 | #include "test/ios/test_support.h" |
oprypin | 51d49b4 | 2017-08-22 10:55:47 -0700 | [diff] [blame] | 21 | |
| 22 | DEFINE_string(NSTreatUnknownArgumentsAsOpen, "", |
| 23 | "Intentionally ignored flag intended for iOS simulator."); |
| 24 | DEFINE_string(ApplePersistenceIgnoreState, "", |
| 25 | "Intentionally ignored flag intended for iOS simulator."); |
Kári Tristan Helgason | e2baffb | 2017-06-09 10:31:58 +0200 | [diff] [blame] | 26 | #endif |
| 27 | |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 28 | DEFINE_bool(logs, false, "print logs to stderr"); |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 29 | |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 +0000 | [diff] [blame] | 30 | DEFINE_string(force_fieldtrials, "", |
| 31 | "Field trials control experimental feature code which can be forced. " |
| 32 | "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 33 | " will assign the group Enable to field trial WebRTC-FooFeature."); |
| 34 | |
oprypin | 9b2f20c | 2017-08-29 05:51:57 -0700 | [diff] [blame] | 35 | DEFINE_bool(help, false, "Print this message."); |
| 36 | |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 37 | int main(int argc, char* argv[]) { |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 38 | ::testing::InitGoogleMock(&argc, argv); |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 39 | |
Peter Boström | def5820 | 2015-11-27 17:53:22 +0100 | [diff] [blame] | 40 | // Default to LS_INFO, even for release builds to provide better test logging. |
| 41 | // TODO(pbos): Consider adding a command-line override. |
| 42 | if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) |
| 43 | rtc::LogMessage::LogToDebug(rtc::LS_INFO); |
| 44 | |
oprypin | 9b2f20c | 2017-08-29 05:51:57 -0700 | [diff] [blame] | 45 | if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false)) { |
| 46 | return 1; |
| 47 | } |
| 48 | if (FLAG_help) { |
| 49 | rtc::FlagList::Print(nullptr, false); |
| 50 | return 0; |
| 51 | } |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 +0000 | [diff] [blame] | 52 | |
| 53 | webrtc::test::SetExecutablePath(argv[0]); |
oprypin | 9b2f20c | 2017-08-29 05:51:57 -0700 | [diff] [blame] | 54 | std::string fieldtrials = FLAG_force_fieldtrials; |
| 55 | webrtc::test::InitFieldTrialsFromString(fieldtrials); |
asapersson | 01d70a3 | 2016-05-20 06:29:46 -0700 | [diff] [blame] | 56 | webrtc::metrics::Enable(); |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 57 | |
oprypin | 9b2f20c | 2017-08-29 05:51:57 -0700 | [diff] [blame] | 58 | rtc::LogMessage::SetLogToStderr(FLAG_logs); |
Kári Tristan Helgason | e2baffb | 2017-06-09 10:31:58 +0200 | [diff] [blame] | 59 | #if defined(WEBRTC_IOS) |
| 60 | rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv); |
| 61 | rtc::test::RunTestsFromIOSApp(); |
| 62 | #endif |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 63 | |
mflodman@webrtc.org | eae7924 | 2014-06-05 09:32:51 +0000 | [diff] [blame] | 64 | return RUN_ALL_TESTS(); |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 65 | } |