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 "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "webrtc/test/testsupport/fileutils.h" 17 #include "webrtc/test/testsupport/trace_to_stderr.h" 18 #include "webrtc/test/field_trial.h" 19 20 DEFINE_bool(logs, false, "print logs to stderr"); 21 22 DEFINE_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 27 namespace webrtc { 28 namespace test { 29 30 TestSuite::TestSuite(int argc, char** argv) { 31 SetExecutablePath(argv[0]); 32 testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally. 33 // AllowCommandLineParsing allows us to ignore flags passed on to us by 34 // Chromium build bots without having to explicitly disable them. 35 google::AllowCommandLineReparsing(); 36 google::ParseCommandLineFlags(&argc, &argv, true); 37 38 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); 39 } 40 41 TestSuite::~TestSuite() { 42 } 43 44 int TestSuite::Run() { 45 Initialize(); 46 int result = RUN_ALL_TESTS(); 47 Shutdown(); 48 return result; 49 } 50 51 void TestSuite::Initialize() { 52 if (FLAGS_logs) 53 trace_to_stderr_.reset(new TraceToStderr); 54 } 55 56 void TestSuite::Shutdown() { 57 } 58 59 } // namespace test 60 } // namespace webrtc 61