blob: 2d7dbe2225c6c2e6da3d341e0817d42ad885c495 [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"
kjellanderc3771cc2017-06-30 13:42:44 -070012#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"
22#endif
23
ehmaldonado26bddb92016-11-30 06:12:01 -080024DEFINE_bool(logs, false, "print logs to stderr");
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000025
andresp@webrtc.org60015d22014-05-16 09:39:51 +000026DEFINE_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.orgaf8d5af2013-07-09 08:02:33 +000031int main(int argc, char* argv[]) {
ehmaldonado26bddb92016-11-30 06:12:01 -080032 ::testing::InitGoogleMock(&argc, argv);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000033
Peter Boströmdef58202015-11-27 17:53:22 +010034 // 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.org60015d22014-05-16 09:39:51 +000039 // 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);
asapersson01d70a32016-05-20 06:29:46 -070046 webrtc::metrics::Enable();
ehmaldonado26bddb92016-11-30 06:12:01 -080047
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 Helgasone2baffb2017-06-09 10:31:58 +020052#if defined(WEBRTC_IOS)
53 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
54 rtc::test::RunTestsFromIOSApp();
55#endif
ehmaldonado26bddb92016-11-30 06:12:01 -080056
mflodman@webrtc.orgeae79242014-06-05 09:32:51 +000057 return RUN_ALL_TESTS();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000058}