diff --git a/webrtc/test/flags.cc b/webrtc/test/flags.cc deleted file mode 100644 index 088efff0b8..0000000000 --- a/webrtc/test/flags.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#include "webrtc/test/flags.h" - -#include "gflags/gflags.h" - -namespace webrtc { -namespace test { -namespace flags { - -void Init(int* argc, char*** argv) { - // AllowCommandLineParsing allows us to ignore flags passed on to us by - // Chromium build bots without having to explicitly disable them. - google::AllowCommandLineReparsing(); - google::ParseCommandLineFlags(argc, argv, true); -} - -DEFINE_int32(width, 640, "Video width."); -size_t Width() { return static_cast(FLAGS_width); } - -DEFINE_int32(height, 480, "Video height."); -size_t Height() { return static_cast(FLAGS_height); } - -DEFINE_int32(fps, 30, "Frames per second."); -int Fps() { return static_cast(FLAGS_fps); } - -DEFINE_int32(min_bitrate, 50, "Minimum video bitrate."); -size_t MinBitrate() { return static_cast(FLAGS_min_bitrate); } - -DEFINE_int32(start_bitrate, 300, "Video starting bitrate."); -size_t StartBitrate() { return static_cast(FLAGS_start_bitrate); } - -DEFINE_int32(max_bitrate, 800, "Maximum video bitrate."); -size_t MaxBitrate() { return static_cast(FLAGS_max_bitrate); } -} // flags -} // test -} // webrtc diff --git a/webrtc/test/flags.h b/webrtc/test/flags.h deleted file mode 100644 index fb5f5fc9c9..0000000000 --- a/webrtc/test/flags.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FLAGS_H_ -#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FLAGS_H_ - -#include - -namespace webrtc { -namespace test { -namespace flags { - -void Init(int* argc, char ***argv); - -size_t Width(); -size_t Height(); -int Fps(); -size_t MinBitrate(); -size_t StartBitrate(); -size_t MaxBitrate(); -} // flags -} // test -} // webrtc - -#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FLAGS_H_ diff --git a/webrtc/test/test_main.cc b/webrtc/test/test_main.cc index b57b032daf..64109d433a 100644 --- a/webrtc/test/test_main.cc +++ b/webrtc/test/test_main.cc @@ -10,13 +10,11 @@ #include "testing/gtest/include/gtest/gtest.h" -#include "webrtc/test/flags.h" #include "webrtc/test/run_tests.h" #include "webrtc/test/testsupport/fileutils.h" int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); - webrtc::test::flags::Init(&argc, &argv); webrtc::test::SetExecutablePath(argv[0]); return webrtc::test::RunAllTests(); diff --git a/webrtc/test/webrtc_test_common.gyp b/webrtc/test/webrtc_test_common.gyp index bec5803fcf..4c514986ba 100644 --- a/webrtc/test/webrtc_test_common.gyp +++ b/webrtc/test/webrtc_test_common.gyp @@ -28,8 +28,6 @@ 'fake_encoder.h', 'fake_network_pipe.cc', 'fake_network_pipe.h', - 'flags.cc', - 'flags.h', 'frame_generator_capturer.cc', 'frame_generator_capturer.h', 'mock_transport.h', @@ -84,7 +82,6 @@ }, 'dependencies': [ '<(DEPTH)/testing/gtest.gyp:gtest', - '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', '<(webrtc_root)/modules/modules.gyp:video_capture_module', '<(webrtc_root)/modules/modules.gyp:media_file', '<(webrtc_root)/test/test.gyp:frame_generator', diff --git a/webrtc/video/full_stack.cc b/webrtc/video/full_stack.cc index 51c0a8a7cb..dbd234b8ed 100644 --- a/webrtc/video/full_stack.cc +++ b/webrtc/video/full_stack.cc @@ -12,7 +12,6 @@ #include #include -#include "gflags/gflags.h" #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/call.h" @@ -33,11 +32,10 @@ #include "webrtc/test/testsupport/fileutils.h" #include "webrtc/typedefs.h" -DEFINE_int32(seconds, 10, "Seconds to run each clip."); - namespace webrtc { static const uint32_t kSendSsrc = 0x654321; +static const int kFullStackTestDurationSecs = 10; struct FullStackTestParams { const char* test_label; @@ -391,7 +389,7 @@ TEST_P(FullStackTest, NoPacketLoss) { params.test_label, params.avg_psnr_threshold, params.avg_ssim_threshold, - FLAGS_seconds * params.clip.fps); + kFullStackTestDurationSecs * params.clip.fps); Call::Config call_config(&analyzer); diff --git a/webrtc/video/loopback.cc b/webrtc/video/loopback.cc index c99183a027..98e32c6453 100644 --- a/webrtc/video/loopback.cc +++ b/webrtc/video/loopback.cc @@ -12,6 +12,7 @@ #include +#include "gflags/gflags.h" #include "testing/gtest/include/gtest/gtest.h" #include "webrtc/call.h" @@ -21,7 +22,6 @@ #include "webrtc/test/direct_transport.h" #include "webrtc/test/encoder_settings.h" #include "webrtc/test/fake_encoder.h" -#include "webrtc/test/flags.h" #include "webrtc/test/run_loop.h" #include "webrtc/test/run_tests.h" #include "webrtc/test/video_capturer.h" @@ -29,20 +29,35 @@ #include "webrtc/typedefs.h" namespace webrtc { +namespace flags { -class LoopbackTest : public ::testing::Test { - protected: - std::map reserved_ssrcs_; -}; +DEFINE_int32(width, 640, "Video width."); +size_t Width() { return static_cast(FLAGS_width); } + +DEFINE_int32(height, 480, "Video height."); +size_t Height() { return static_cast(FLAGS_height); } + +DEFINE_int32(fps, 30, "Frames per second."); +int Fps() { return static_cast(FLAGS_fps); } + +DEFINE_int32(min_bitrate, 50, "Minimum video bitrate."); +size_t MinBitrate() { return static_cast(FLAGS_min_bitrate); } + +DEFINE_int32(start_bitrate, 300, "Video starting bitrate."); +size_t StartBitrate() { return static_cast(FLAGS_start_bitrate); } + +DEFINE_int32(max_bitrate, 800, "Maximum video bitrate."); +size_t MaxBitrate() { return static_cast(FLAGS_max_bitrate); } +} // namespace flags static const uint32_t kSendSsrc = 0x654321; static const uint32_t kReceiverLocalSsrc = 0x123456; -TEST_F(LoopbackTest, Test) { +void Loopback() { scoped_ptr local_preview(test::VideoRenderer::Create( - "Local Preview", test::flags::Width(), test::flags::Height())); + "Local Preview", flags::Width(), flags::Height())); scoped_ptr loopback_video(test::VideoRenderer::Create( - "Loopback Video", test::flags::Width(), test::flags::Height())); + "Loopback Video", flags::Width(), flags::Height())); test::DirectTransport transport; Call::Config call_config(&transport); @@ -60,12 +75,12 @@ TEST_F(LoopbackTest, Test) { send_config.encoder_settings = test::CreateEncoderSettings(encoder.get(), "VP8", 124, 1); VideoStream* stream = &send_config.encoder_settings.streams[0]; - stream->width = test::flags::Width(); - stream->height = test::flags::Height(); - stream->min_bitrate_bps = static_cast(test::flags::MinBitrate()) * 1000; + stream->width = flags::Width(); + stream->height = flags::Height(); + stream->min_bitrate_bps = static_cast(flags::MinBitrate()) * 1000; stream->target_bitrate_bps = - static_cast(test::flags::MaxBitrate()) * 1000; - stream->max_bitrate_bps = static_cast(test::flags::MaxBitrate()) * 1000; + static_cast(flags::MaxBitrate()) * 1000; + stream->max_bitrate_bps = static_cast(flags::MaxBitrate()) * 1000; stream->max_framerate = 30; stream->max_qp = 56; @@ -75,9 +90,9 @@ TEST_F(LoopbackTest, Test) { scoped_ptr camera( test::VideoCapturer::Create(send_stream->Input(), - test::flags::Width(), - test::flags::Height(), - test::flags::Fps(), + flags::Width(), + flags::Height(), + flags::Fps(), test_clock)); VideoReceiveStream::Config receive_config = call->GetDefaultReceiveConfig(); @@ -107,3 +122,11 @@ TEST_F(LoopbackTest, Test) { transport.StopSending(); } } // namespace webrtc + +int main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + google::ParseCommandLineFlags(&argc, &argv, true); + + webrtc::Loopback(); + return 0; +} diff --git a/webrtc/webrtc_tests.gypi b/webrtc/webrtc_tests.gypi index 1ff3a9c281..384f57cc93 100644 --- a/webrtc/webrtc_tests.gypi +++ b/webrtc/webrtc_tests.gypi @@ -21,10 +21,10 @@ 'type': 'executable', 'sources': [ 'video/loopback.cc', - 'test/test_main.cc', ], 'dependencies': [ '<(DEPTH)/testing/gtest.gyp:gtest', + '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', 'test/webrtc_test_common.gyp:webrtc_test_common', 'webrtc', ], @@ -43,7 +43,6 @@ ], 'dependencies': [ '<(DEPTH)/testing/gtest.gyp:gtest', - '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', 'modules/modules.gyp:rtp_rtcp', 'test/metrics.gyp:metrics', 'test/webrtc_test_common.gyp:webrtc_test_common', @@ -62,7 +61,6 @@ ], 'dependencies': [ '<(DEPTH)/testing/gtest.gyp:gtest', - '<(DEPTH)/third_party/gflags/gflags.gyp:gflags', 'modules/modules.gyp:neteq_test_support', # Needed by neteq_performance_unittest. 'modules/modules.gyp:rtp_rtcp', 'test/webrtc_test_common.gyp:webrtc_test_common',