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 | |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 +0000 | [diff] [blame] | 11 | #include "gflags/gflags.h" |
Henrik Kjellander | a80c16a | 2017-07-01 16:48:15 +0200 | [diff] [blame] | 12 | #include "webrtc/base/logging.h" |
asapersson | 01d70a3 | 2016-05-20 06:29:46 -0700 | [diff] [blame] | 13 | #include "webrtc/system_wrappers/include/metrics_default.h" |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 +0000 | [diff] [blame] | 14 | #include "webrtc/test/field_trial.h" |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 15 | #include "webrtc/test/gmock.h" |
kwiberg | ac9f876 | 2016-09-30 22:29:43 -0700 | [diff] [blame] | 16 | #include "webrtc/test/gtest.h" |
pbos@webrtc.org | fbf0f69 | 2013-08-21 16:00:15 +0000 | [diff] [blame] | 17 | #include "webrtc/test/testsupport/fileutils.h" |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 18 | #include "webrtc/test/testsupport/trace_to_stderr.h" |
| 19 | |
Kári Tristan Helgason | e2baffb | 2017-06-09 10:31:58 +0200 | [diff] [blame] | 20 | #if defined(WEBRTC_IOS) |
| 21 | #include "webrtc/test/ios/test_support.h" |
| 22 | #endif |
| 23 | |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 24 | DEFINE_bool(logs, false, "print logs to stderr"); |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 25 | |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 +0000 | [diff] [blame] | 26 | DEFINE_string(force_fieldtrials, "", |
| 27 | "Field trials control experimental feature code which can be forced. " |
| 28 | "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 29 | " will assign the group Enable to field trial WebRTC-FooFeature."); |
| 30 | |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 31 | int main(int argc, char* argv[]) { |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 32 | ::testing::InitGoogleMock(&argc, argv); |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 33 | |
Peter Boström | def5820 | 2015-11-27 17:53:22 +0100 | [diff] [blame] | 34 | // Default to LS_INFO, even for release builds to provide better test logging. |
| 35 | // TODO(pbos): Consider adding a command-line override. |
| 36 | if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) |
| 37 | rtc::LogMessage::LogToDebug(rtc::LS_INFO); |
| 38 | |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 +0000 | [diff] [blame] | 39 | // AllowCommandLineParsing allows us to ignore flags passed on to us by |
| 40 | // Chromium build bots without having to explicitly disable them. |
| 41 | google::AllowCommandLineReparsing(); |
| 42 | google::ParseCommandLineFlags(&argc, &argv, false); |
| 43 | |
| 44 | webrtc::test::SetExecutablePath(argv[0]); |
| 45 | webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); |
asapersson | 01d70a3 | 2016-05-20 06:29:46 -0700 | [diff] [blame] | 46 | webrtc::metrics::Enable(); |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 47 | |
| 48 | rtc::LogMessage::SetLogToStderr(FLAGS_logs); |
| 49 | std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr; |
| 50 | if (FLAGS_logs) |
| 51 | trace_to_stderr.reset(new webrtc::test::TraceToStderr); |
Kári Tristan Helgason | e2baffb | 2017-06-09 10:31:58 +0200 | [diff] [blame] | 52 | #if defined(WEBRTC_IOS) |
| 53 | rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv); |
| 54 | rtc::test::RunTestsFromIOSApp(); |
| 55 | #endif |
ehmaldonado | 26bddb9 | 2016-11-30 06:12:01 -0800 | [diff] [blame] | 56 | |
mflodman@webrtc.org | eae7924 | 2014-06-05 09:32:51 +0000 | [diff] [blame] | 57 | return RUN_ALL_TESTS(); |
pbos@webrtc.org | af8d5af | 2013-07-09 08:02:33 +0000 | [diff] [blame] | 58 | } |