blob: 3f6d4f187c9ef0e337598398fcc4a6a26cc91660 [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
andresp@webrtc.org60015d22014-05-16 09:39:51 +000011#include "gflags/gflags.h"
Edward Lemurc20978e2017-07-06 19:44:34 +020012#include "webrtc/rtc_base/logging.h"
asapersson01d70a32016-05-20 06:29:46 -070013#include "webrtc/system_wrappers/include/metrics_default.h"
andresp@webrtc.org60015d22014-05-16 09:39:51 +000014#include "webrtc/test/field_trial.h"
ehmaldonado26bddb92016-11-30 06:12:01 -080015#include "webrtc/test/gmock.h"
kwibergac9f8762016-09-30 22:29:43 -070016#include "webrtc/test/gtest.h"
pbos@webrtc.orgfbf0f692013-08-21 16:00:15 +000017#include "webrtc/test/testsupport/fileutils.h"
ehmaldonado26bddb92016-11-30 06:12:01 -080018#include "webrtc/test/testsupport/trace_to_stderr.h"
19
Kári Tristan Helgasone2baffb2017-06-09 10:31:58 +020020#if defined(WEBRTC_IOS)
21#include "webrtc/test/ios/test_support.h"
oprypin51d49b42017-08-22 10:55:47 -070022
23DEFINE_string(NSTreatUnknownArgumentsAsOpen, "",
24 "Intentionally ignored flag intended for iOS simulator.");
25DEFINE_string(ApplePersistenceIgnoreState, "",
26 "Intentionally ignored flag intended for iOS simulator.");
Kári Tristan Helgasone2baffb2017-06-09 10:31:58 +020027#endif
28
ehmaldonado26bddb92016-11-30 06:12:01 -080029DEFINE_bool(logs, false, "print logs to stderr");
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000030
andresp@webrtc.org60015d22014-05-16 09:39:51 +000031DEFINE_string(force_fieldtrials, "",
32 "Field trials control experimental feature code which can be forced. "
33 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
34 " will assign the group Enable to field trial WebRTC-FooFeature.");
35
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000036int main(int argc, char* argv[]) {
ehmaldonado26bddb92016-11-30 06:12:01 -080037 ::testing::InitGoogleMock(&argc, argv);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000038
Peter Boströmdef58202015-11-27 17:53:22 +010039 // Default to LS_INFO, even for release builds to provide better test logging.
40 // TODO(pbos): Consider adding a command-line override.
41 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
42 rtc::LogMessage::LogToDebug(rtc::LS_INFO);
43
andresp@webrtc.org60015d22014-05-16 09:39:51 +000044 google::ParseCommandLineFlags(&argc, &argv, false);
45
46 webrtc::test::SetExecutablePath(argv[0]);
47 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
asapersson01d70a32016-05-20 06:29:46 -070048 webrtc::metrics::Enable();
ehmaldonado26bddb92016-11-30 06:12:01 -080049
50 rtc::LogMessage::SetLogToStderr(FLAGS_logs);
51 std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr;
52 if (FLAGS_logs)
53 trace_to_stderr.reset(new webrtc::test::TraceToStderr);
Kári Tristan Helgasone2baffb2017-06-09 10:31:58 +020054#if defined(WEBRTC_IOS)
55 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
56 rtc::test::RunTestsFromIOSApp();
57#endif
ehmaldonado26bddb92016-11-30 06:12:01 -080058
mflodman@webrtc.orgeae79242014-06-05 09:32:51 +000059 return RUN_ALL_TESTS();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000060}