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

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

Issue 2995363002: Replace gflags usages with rtc_base/flags in all targets based on test_main (Closed)
Patch Set: Fix string use after free Created 3 years, 3 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/BUILD.gn ('k') | webrtc/test/testsupport/test_output.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) 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 "webrtc/rtc_base/flags.h"
12 #include "webrtc/rtc_base/logging.h" 12 #include "webrtc/rtc_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/gmock.h"
16 #include "webrtc/test/gtest.h" 16 #include "webrtc/test/gtest.h"
17 #include "webrtc/test/testsupport/fileutils.h" 17 #include "webrtc/test/testsupport/fileutils.h"
18 #include "webrtc/test/testsupport/trace_to_stderr.h" 18 #include "webrtc/test/testsupport/trace_to_stderr.h"
19 19
20 #if defined(WEBRTC_IOS) 20 #if defined(WEBRTC_IOS)
21 #include "webrtc/test/ios/test_support.h" 21 #include "webrtc/test/ios/test_support.h"
22 22
23 DEFINE_string(NSTreatUnknownArgumentsAsOpen, "", 23 DEFINE_string(NSTreatUnknownArgumentsAsOpen, "",
24 "Intentionally ignored flag intended for iOS simulator."); 24 "Intentionally ignored flag intended for iOS simulator.");
25 DEFINE_string(ApplePersistenceIgnoreState, "", 25 DEFINE_string(ApplePersistenceIgnoreState, "",
26 "Intentionally ignored flag intended for iOS simulator."); 26 "Intentionally ignored flag intended for iOS simulator.");
27 #endif 27 #endif
28 28
29 DEFINE_bool(logs, false, "print logs to stderr"); 29 DEFINE_bool(logs, false, "print logs to stderr");
30 30
31 DEFINE_string(force_fieldtrials, "", 31 DEFINE_string(force_fieldtrials, "",
32 "Field trials control experimental feature code which can be forced. " 32 "Field trials control experimental feature code which can be forced. "
33 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" 33 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
34 " will assign the group Enable to field trial WebRTC-FooFeature."); 34 " will assign the group Enable to field trial WebRTC-FooFeature.");
35 35
36 DEFINE_bool(help, false, "Print this message.");
37
36 int main(int argc, char* argv[]) { 38 int main(int argc, char* argv[]) {
37 ::testing::InitGoogleMock(&argc, argv); 39 ::testing::InitGoogleMock(&argc, argv);
38 40
39 // Default to LS_INFO, even for release builds to provide better test logging. 41 // Default to LS_INFO, even for release builds to provide better test logging.
40 // TODO(pbos): Consider adding a command-line override. 42 // TODO(pbos): Consider adding a command-line override.
41 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) 43 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
42 rtc::LogMessage::LogToDebug(rtc::LS_INFO); 44 rtc::LogMessage::LogToDebug(rtc::LS_INFO);
43 45
44 google::ParseCommandLineFlags(&argc, &argv, false); 46 if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false)) {
47 return 1;
48 }
49 if (FLAG_help) {
50 rtc::FlagList::Print(nullptr, false);
51 return 0;
52 }
45 53
46 webrtc::test::SetExecutablePath(argv[0]); 54 webrtc::test::SetExecutablePath(argv[0]);
47 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); 55 std::string fieldtrials = FLAG_force_fieldtrials;
56 webrtc::test::InitFieldTrialsFromString(fieldtrials);
48 webrtc::metrics::Enable(); 57 webrtc::metrics::Enable();
49 58
50 rtc::LogMessage::SetLogToStderr(FLAGS_logs); 59 rtc::LogMessage::SetLogToStderr(FLAG_logs);
51 std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr; 60 std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr;
52 if (FLAGS_logs) 61 if (FLAG_logs)
53 trace_to_stderr.reset(new webrtc::test::TraceToStderr); 62 trace_to_stderr.reset(new webrtc::test::TraceToStderr);
54 #if defined(WEBRTC_IOS) 63 #if defined(WEBRTC_IOS)
55 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv); 64 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
56 rtc::test::RunTestsFromIOSApp(); 65 rtc::test::RunTestsFromIOSApp();
57 #endif 66 #endif
58 67
59 return RUN_ALL_TESTS(); 68 return RUN_ALL_TESTS();
60 } 69 }
OLDNEW
« no previous file with comments | « webrtc/test/BUILD.gn ('k') | webrtc/test/testsupport/test_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698