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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/test/BUILD.gn ('k') | webrtc/test/testsupport/test_output.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/test_main.cc
diff --git a/webrtc/test/test_main.cc b/webrtc/test/test_main.cc
index 3f6d4f187c9ef0e337598398fcc4a6a26cc91660..3790a68afe3ec6d25b6548fe53ac13eec7776470 100644
--- a/webrtc/test/test_main.cc
+++ b/webrtc/test/test_main.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "gflags/gflags.h"
+#include "webrtc/rtc_base/flags.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/system_wrappers/include/metrics_default.h"
#include "webrtc/test/field_trial.h"
@@ -33,6 +33,8 @@ DEFINE_string(force_fieldtrials, "",
"E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
" will assign the group Enable to field trial WebRTC-FooFeature.");
+DEFINE_bool(help, false, "Print this message.");
+
int main(int argc, char* argv[]) {
::testing::InitGoogleMock(&argc, argv);
@@ -41,15 +43,22 @@ int main(int argc, char* argv[]) {
if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
rtc::LogMessage::LogToDebug(rtc::LS_INFO);
- google::ParseCommandLineFlags(&argc, &argv, false);
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false)) {
+ return 1;
+ }
+ if (FLAG_help) {
+ rtc::FlagList::Print(nullptr, false);
+ return 0;
+ }
webrtc::test::SetExecutablePath(argv[0]);
- webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
+ std::string fieldtrials = FLAG_force_fieldtrials;
+ webrtc::test::InitFieldTrialsFromString(fieldtrials);
webrtc::metrics::Enable();
- rtc::LogMessage::SetLogToStderr(FLAGS_logs);
+ rtc::LogMessage::SetLogToStderr(FLAG_logs);
std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr;
- if (FLAGS_logs)
+ if (FLAG_logs)
trace_to_stderr.reset(new webrtc::test::TraceToStderr);
#if defined(WEBRTC_IOS)
rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
« 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