Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: webrtc/test/test_suite.cc

Issue 1915523002: Add a default implementation in metrics_default.cc of histograms methods in system_wrappers/interfac (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/test_main.cc ('k') | webrtc/video/call_stats_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 "webrtc/test/test_suite.h" 11 #include "webrtc/test/test_suite.h"
12 12
13 #include "gflags/gflags.h" 13 #include "gflags/gflags.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webrtc/base/logging.h" 16 #include "webrtc/base/logging.h"
17 #include "webrtc/system_wrappers/include/metrics_default.h"
17 #include "webrtc/test/testsupport/fileutils.h" 18 #include "webrtc/test/testsupport/fileutils.h"
18 #include "webrtc/test/testsupport/trace_to_stderr.h" 19 #include "webrtc/test/testsupport/trace_to_stderr.h"
19 #include "webrtc/test/field_trial.h" 20 #include "webrtc/test/field_trial.h"
20 21
21 DEFINE_bool(logs, false, "print logs to stderr"); 22 DEFINE_bool(logs, false, "print logs to stderr");
22 23
23 DEFINE_string(force_fieldtrials, "", 24 DEFINE_string(force_fieldtrials, "",
24 "Field trials control experimental feature code which can be forced. " 25 "Field trials control experimental feature code which can be forced. "
25 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" 26 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
26 " will assign the group Enable to field trial WebRTC-FooFeature."); 27 " will assign the group Enable to field trial WebRTC-FooFeature.");
27 28
28 namespace webrtc { 29 namespace webrtc {
29 namespace test { 30 namespace test {
30 31
31 TestSuite::TestSuite(int argc, char** argv) { 32 TestSuite::TestSuite(int argc, char** argv) {
32 SetExecutablePath(argv[0]); 33 SetExecutablePath(argv[0]);
33 testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally. 34 testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally.
34 // AllowCommandLineParsing allows us to ignore flags passed on to us by 35 // AllowCommandLineParsing allows us to ignore flags passed on to us by
35 // Chromium build bots without having to explicitly disable them. 36 // Chromium build bots without having to explicitly disable them.
36 google::AllowCommandLineReparsing(); 37 google::AllowCommandLineReparsing();
37 google::ParseCommandLineFlags(&argc, &argv, true); 38 google::ParseCommandLineFlags(&argc, &argv, true);
38 39
39 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); 40 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
41 webrtc::metrics::Enable();
40 } 42 }
41 43
42 TestSuite::~TestSuite() { 44 TestSuite::~TestSuite() {
43 } 45 }
44 46
45 int TestSuite::Run() { 47 int TestSuite::Run() {
46 Initialize(); 48 Initialize();
47 int result = RUN_ALL_TESTS(); 49 int result = RUN_ALL_TESTS();
48 Shutdown(); 50 Shutdown();
49 return result; 51 return result;
50 } 52 }
51 53
52 void TestSuite::Initialize() { 54 void TestSuite::Initialize() {
53 rtc::LogMessage::SetLogToStderr(FLAGS_logs); 55 rtc::LogMessage::SetLogToStderr(FLAGS_logs);
54 if (FLAGS_logs) 56 if (FLAGS_logs)
55 trace_to_stderr_.reset(new TraceToStderr); 57 trace_to_stderr_.reset(new TraceToStderr);
56 } 58 }
57 59
58 void TestSuite::Shutdown() { 60 void TestSuite::Shutdown() {
59 } 61 }
60 62
61 } // namespace test 63 } // namespace test
62 } // namespace webrtc 64 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/test_main.cc ('k') | webrtc/video/call_stats_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698