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

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

Issue 2968003003: Stop silently accepting unsupported flags in test binaries (Closed)
Patch Set: Add TODO 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 unified diff | Download patch
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 "gflags/gflags.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
23 DEFINE_string(NSTreatUnknownArgumentsAsOpen, "",
24 "Intentionally ignored flag intended for iOS simulator.");
25 DEFINE_string(ApplePersistenceIgnoreState, "",
26 "Intentionally ignored flag intended for iOS simulator.");
22 #endif 27 #endif
23 28
24 DEFINE_bool(logs, false, "print logs to stderr"); 29 DEFINE_bool(logs, false, "print logs to stderr");
25 30
26 DEFINE_string(force_fieldtrials, "", 31 DEFINE_string(force_fieldtrials, "",
27 "Field trials control experimental feature code which can be forced. " 32 "Field trials control experimental feature code which can be forced. "
28 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" 33 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
29 " will assign the group Enable to field trial WebRTC-FooFeature."); 34 " will assign the group Enable to field trial WebRTC-FooFeature.");
30 35
31 int main(int argc, char* argv[]) { 36 int main(int argc, char* argv[]) {
32 ::testing::InitGoogleMock(&argc, argv); 37 ::testing::InitGoogleMock(&argc, argv);
33 38
34 // Default to LS_INFO, even for release builds to provide better test logging. 39 // Default to LS_INFO, even for release builds to provide better test logging.
35 // TODO(pbos): Consider adding a command-line override. 40 // TODO(pbos): Consider adding a command-line override.
36 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) 41 if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
37 rtc::LogMessage::LogToDebug(rtc::LS_INFO); 42 rtc::LogMessage::LogToDebug(rtc::LS_INFO);
38 43
39 // AllowCommandLineParsing allows us to ignore flags passed on to us by
40 // Chromium build bots without having to explicitly disable them.
41 google::AllowCommandLineReparsing();
42 google::ParseCommandLineFlags(&argc, &argv, false); 44 google::ParseCommandLineFlags(&argc, &argv, false);
43 45
44 webrtc::test::SetExecutablePath(argv[0]); 46 webrtc::test::SetExecutablePath(argv[0]);
45 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials); 47 webrtc::test::InitFieldTrialsFromString(FLAGS_force_fieldtrials);
46 webrtc::metrics::Enable(); 48 webrtc::metrics::Enable();
47 49
48 rtc::LogMessage::SetLogToStderr(FLAGS_logs); 50 rtc::LogMessage::SetLogToStderr(FLAGS_logs);
49 std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr; 51 std::unique_ptr<webrtc::test::TraceToStderr> trace_to_stderr;
50 if (FLAGS_logs) 52 if (FLAGS_logs)
51 trace_to_stderr.reset(new webrtc::test::TraceToStderr); 53 trace_to_stderr.reset(new webrtc::test::TraceToStderr);
52 #if defined(WEBRTC_IOS) 54 #if defined(WEBRTC_IOS)
53 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv); 55 rtc::test::InitTestSuite(RUN_ALL_TESTS, argc, argv);
54 rtc::test::RunTestsFromIOSApp(); 56 rtc::test::RunTestsFromIOSApp();
55 #endif 57 #endif
56 58
57 return RUN_ALL_TESTS(); 59 return RUN_ALL_TESTS();
58 } 60 }
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc ('k') | webrtc/voice_engine/test/auto_test/voe_standard_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698