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

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: Improve error messages 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
Index: webrtc/test/test_main.cc
diff --git a/webrtc/test/test_main.cc b/webrtc/test/test_main.cc
index 3f6d4f187c9ef0e337598398fcc4a6a26cc91660..de4932f116ac164782c05142973b230d5d676eb6 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,19 @@ int main(int argc, char* argv[]) {
if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
rtc::LogMessage::LogToDebug(rtc::LS_INFO);
- google::ParseCommandLineFlags(&argc, &argv, false);
+ rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false);
+ if (FLAG_help) {
+ rtc::FlagList::Print(nullptr, false);
+ return 0;
+ }
webrtc::test::SetExecutablePath(argv[0]);
- webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
+ webrtc::test::InitFieldTrialsFromString(FLAG_force_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);

Powered by Google App Engine
This is Rietveld 408576698