OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "gflags/gflags.h" | 11 #include "gflags/gflags.h" |
12 #include "webrtc/base/logging.h" | 12 #include "webrtc/base/logging.h" |
13 #include "webrtc/system_wrappers/include/metrics_default.h" | 13 #include "webrtc/system_wrappers/include/metrics_default.h" |
14 #include "webrtc/test/field_trial.h" | 14 #include "webrtc/test/field_trial.h" |
| 15 #include "webrtc/test/gmock.h" |
15 #include "webrtc/test/gtest.h" | 16 #include "webrtc/test/gtest.h" |
16 #include "webrtc/test/testsupport/fileutils.h" | 17 #include "webrtc/test/testsupport/fileutils.h" |
| 18 #include "webrtc/test/testsupport/trace_to_stderr.h" |
| 19 |
| 20 DEFINE_bool(logs, false, "print logs to stderr"); |
17 | 21 |
18 DEFINE_string(force_fieldtrials, "", | 22 DEFINE_string(force_fieldtrials, "", |
19 "Field trials control experimental feature code which can be forced. " | 23 "Field trials control experimental feature code which can be forced. " |
20 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | 24 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
21 " will assign the group Enable to field trial WebRTC-FooFeature."); | 25 " will assign the group Enable to field trial WebRTC-FooFeature."); |
22 | 26 |
23 int main(int argc, char* argv[]) { | 27 int main(int argc, char* argv[]) { |
24 ::testing::InitGoogleTest(&argc, argv); | 28 ::testing::InitGoogleMock(&argc, argv); |
25 | 29 |
26 // Default to LS_INFO, even for release builds to provide better test logging. | 30 // Default to LS_INFO, even for release builds to provide better test logging. |
27 // TODO(pbos): Consider adding a command-line override. | 31 // TODO(pbos): Consider adding a command-line override. |
28 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) | 32 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) |
29 rtc::LogMessage::LogToDebug(rtc::LS_INFO); | 33 rtc::LogMessage::LogToDebug(rtc::LS_INFO); |
30 | 34 |
31 // AllowCommandLineParsing allows us to ignore flags passed on to us by | 35 // AllowCommandLineParsing allows us to ignore flags passed on to us by |
32 // Chromium build bots without having to explicitly disable them. | 36 // Chromium build bots without having to explicitly disable them. |
33 google::AllowCommandLineReparsing(); | 37 google::AllowCommandLineReparsing(); |
34 google::ParseCommandLineFlags(&argc, &argv, false); | 38 google::ParseCommandLineFlags(&argc, &argv, false); |
35 | 39 |
36 webrtc::test::SetExecutablePath(argv[0]); | 40 webrtc::test::SetExecutablePath(argv[0]); |
37 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); | 41 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); |
38 webrtc::metrics::Enable(); | 42 webrtc::metrics::Enable(); |
| 43 |
| 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 |
39 return RUN_ALL_TESTS(); | 49 return RUN_ALL_TESTS(); |
40 } | 50 } |
OLD | NEW |