blob: 1b1cdba789454e9884cb81c087ae492d496c990a [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"
Peter Boströmdef58202015-11-27 17:53:22 +010012#include "webrtc/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
20DEFINE_bool(logs, false, "print logs to stderr");
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000021
andresp@webrtc.org60015d22014-05-16 09:39:51 +000022DEFINE_string(force_fieldtrials, "",
23 "Field trials control experimental feature code which can be forced. "
24 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
25 " will assign the group Enable to field trial WebRTC-FooFeature.");
26
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000027int main(int argc, char* argv[]) {
ehmaldonado26bddb92016-11-30 06:12:01 -080028 ::testing::InitGoogleMock(&argc, argv);
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000029
Peter Boströmdef58202015-11-27 17:53:22 +010030 // Default to LS_INFO, even for release builds to provide better test logging.
31 // TODO(pbos): Consider adding a command-line override.
32 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
33 rtc::LogMessage::LogToDebug(rtc::LS_INFO);
34
andresp@webrtc.org60015d22014-05-16 09:39:51 +000035 // AllowCommandLineParsing allows us to ignore flags passed on to us by
36 // Chromium build bots without having to explicitly disable them.
37 google::AllowCommandLineReparsing();
38 google::ParseCommandLineFlags(&argc, &argv, false);
39
40 webrtc::test::SetExecutablePath(argv[0]);
41 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
asapersson01d70a32016-05-20 06:29:46 -070042 webrtc::metrics::Enable();
ehmaldonado26bddb92016-11-30 06:12:01 -080043
44 rtc::LogMessage::SetLogToStderr(FLAGS_logs);
45 std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr;
46 if (FLAGS_logs)
47 trace_to_stderr.reset(new webrtc::test::TraceToStderr);
48
mflodman@webrtc.orgeae79242014-06-05 09:32:51 +000049 return RUN_ALL_TESTS();
pbos@webrtc.orgaf8d5af2013-07-09 08:02:33 +000050}