blob: 8bd2ed2244e9213b80d8f8dd54016ba1ea5575ea [file] [log] [blame]
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#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"
ehmaldonado26bddb92016-11-30 06:12:01 -080018
Kári Tristan Helgasone2baffb2017-06-09 10:31:58 +020019#if defined(WEBRTC_IOS)
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "test/ios/test_support.h"
oprypin51d49b42017-08-22 10:55:47 -070021
22DEFINE_string(NSTreatUnknownArgumentsAsOpen, "",
23 "Intentionally ignored flag intended for iOS simulator.");
24DEFINE_string(ApplePersistenceIgnoreState, "",
25 "Intentionally ignored flag intended for iOS simulator.");
Kári Tristan Helgasone2baffb2017-06-09 10:31:58 +020026#endif
27
ehmaldonado26bddb92016-11-30 06:12:01 -080028DEFINE_bool(logs, false, "print logs to stderr");
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000029
andresp@webrtc.org60015d22014-05-16 09:39:51 +000030DEFINE_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
oprypin9b2f20c2017-08-29 05:51:57 -070035DEFINE_bool(help, false, "Print this message.");
36
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000037int main(int argc, char* argv[]) {
ehmaldonado26bddb92016-11-30 06:12:01 -080038 ::testing::InitGoogleMock(&argc, argv);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000039
Peter Boströmdef58202015-11-27 17:53:22 +010040 // 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
oprypin9b2f20c2017-08-29 05:51:57 -070045 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.org60015d22014-05-16 09:39:51 +000052
53 webrtc::test::SetExecutablePath(argv[0]);
oprypin9b2f20c2017-08-29 05:51:57 -070054 std::string fieldtrials = FLAG_force_fieldtrials;
55 webrtc::test::InitFieldTrialsFromString(fieldtrials);
asapersson01d70a32016-05-20 06:29:46 -070056 webrtc::metrics::Enable();
ehmaldonado26bddb92016-11-30 06:12:01 -080057
oprypin9b2f20c2017-08-29 05:51:57 -070058 rtc::LogMessage::SetLogToStderr(FLAG_logs);
Kári Tristan Helgasone2baffb2017-06-09 10:31:58 +020059#if defined(WEBRTC_IOS)
60 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
61 rtc::test::RunTestsFromIOSApp();
62#endif
ehmaldonado26bddb92016-11-30 06:12:01 -080063
mflodman@webrtc.orgeae79242014-06-05 09:32:51 +000064 return RUN_ALL_TESTS();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000065}