OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2011 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 | |
11 #include "webrtc/test/test_suite.h" | |
12 | |
13 #include "gflags/gflags.h" | |
14 #include "webrtc/base/logging.h" | |
15 #include "webrtc/system_wrappers/include/metrics_default.h" | |
16 #include "webrtc/test/field_trial.h" | |
17 #include "webrtc/test/gmock.h" | |
18 #include "webrtc/test/gtest.h" | |
19 #include "webrtc/test/testsupport/fileutils.h" | |
20 #include "webrtc/test/testsupport/trace_to_stderr.h" | |
21 | |
22 DEFINE_bool(logs, false, "print logs to stderr"); | |
23 | |
24 DEFINE_string(force_fieldtrials, "", | |
25 "Field trials control experimental feature code which can be forced. " | |
26 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | |
27 " will assign the group Enable to field trial WebRTC-FooFeature."); | |
28 | |
29 namespace webrtc { | |
30 namespace test { | |
31 | |
32 TestSuite::TestSuite(int argc, char** argv) { | |
33 SetExecutablePath(argv[0]); | |
34 testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally. | |
35 // 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, true); | |
39 | |
40 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); | |
41 webrtc::metrics::Enable(); | |
42 } | |
43 | |
44 TestSuite::~TestSuite() { | |
45 } | |
46 | |
47 int TestSuite::Run() { | |
48 Initialize(); | |
49 int result = RUN_ALL_TESTS(); | |
50 Shutdown(); | |
51 return result; | |
52 } | |
53 | |
54 void TestSuite::Initialize() { | |
55 rtc::LogMessage::SetLogToStderr(FLAGS_logs); | |
56 if (FLAGS_logs) | |
57 trace_to_stderr_.reset(new TraceToStderr); | |
58 } | |
59 | |
60 void TestSuite::Shutdown() { | |
61 } | |
62 | |
63 } // namespace test | |
64 } // namespace webrtc | |
OLD | NEW |