From 1896cece014c6e76c4e2d020388df7ea9704c34a Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Tue, 20 Feb 2018 09:06:11 +0100 Subject: [PATCH] Removed dependencies from audio send stream unit test The audio send stream unit tests did not use the mocks injected to the fake rtp transport controller send. This CL prepares for removing the fake controller which makes it harder to refactor the rtp transport controller interface. Bug: webrt:8415 Change-Id: I73f7d105e66f9beb80aeaa92f3490cd61c80c5b8 Reviewed-on: https://webrtc-review.googlesource.com/54302 Reviewed-by: Niels Moller Reviewed-by: Oskar Sundbom Commit-Queue: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#22102} --- audio/BUILD.gn | 5 +---- audio/audio_send_stream_unittest.cc | 26 +++++++------------------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/audio/BUILD.gn b/audio/BUILD.gn index cfd320a85b..59302eae2d 100644 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -125,9 +125,9 @@ if (rtc_include_tests) { ":audio_end_to_end_test", "../api:mock_audio_mixer", "../call:mock_call_interfaces", - "../call:mock_rtp_interfaces", "../call:rtp_interfaces", "../call:rtp_receiver", + "../call:rtp_sender", "../common_audio", "../logging:mocks", "../modules:module_api", @@ -136,9 +136,6 @@ if (rtc_include_tests) { "../modules/audio_processing:audio_processing_statistics", "../modules/audio_processing:mocks", "../modules/bitrate_controller:mocks", - "../modules/congestion_controller:congestion_controller", - "../modules/congestion_controller:mock_congestion_controller", - "../modules/pacing:mock_paced_sender", "../modules/pacing:pacing", "../modules/rtp_rtcp:mock_rtp_rtcp", "../modules/rtp_rtcp:rtp_rtcp_format", diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc index 27b49a2849..0c0139352c 100644 --- a/audio/audio_send_stream_unittest.cc +++ b/audio/audio_send_stream_unittest.cc @@ -16,16 +16,12 @@ #include "audio/audio_state.h" #include "audio/conversion.h" #include "audio/mock_voe_channel_proxy.h" -#include "call/fake_rtp_transport_controller_send.h" -#include "call/rtp_transport_controller_send_interface.h" +#include "call/rtp_transport_controller_send.h" #include "logging/rtc_event_log/mock/mock_rtc_event_log.h" #include "modules/audio_device/include/mock_audio_device.h" #include "modules/audio_mixer/audio_mixer_impl.h" #include "modules/audio_processing/include/audio_processing_statistics.h" #include "modules/audio_processing/include/mock_audio_processing.h" -#include "modules/congestion_controller/include/mock/mock_congestion_observer.h" -#include "modules/congestion_controller/include/send_side_congestion_controller.h" -#include "modules/pacing/mock/mock_paced_sender.h" #include "modules/rtp_rtcp/mocks/mock_rtcp_rtt_stats.h" #include "modules/rtp_rtcp/mocks/mock_rtp_rtcp.h" #include "rtc_base/fakeclock.h" @@ -130,12 +126,7 @@ struct ConfigHelper { : stream_config_(nullptr), audio_processing_(new rtc::RefCountedObject()), simulated_clock_(123456), - send_side_cc_(rtc::MakeUnique( - &simulated_clock_, - nullptr /* observer */, - &event_log_, - &pacer_)), - fake_transport_(&packet_router_, &pacer_, send_side_cc_.get()), + rtp_transport_(&simulated_clock_, &event_log_), bitrate_allocator_(&limit_observer_), worker_queue_("ConfigHelper_worker_queue"), audio_encoder_(nullptr) { @@ -171,7 +162,7 @@ struct ConfigHelper { std::unique_ptr CreateAudioSendStream() { return std::unique_ptr( new internal::AudioSendStream( - stream_config_, audio_state_, &worker_queue_, &fake_transport_, + stream_config_, audio_state_, &worker_queue_, &rtp_transport_, &bitrate_allocator_, &event_log_, &rtcp_rtt_stats_, rtc::nullopt, &active_lifetime_, std::unique_ptr(channel_proxy_))); @@ -183,7 +174,7 @@ struct ConfigHelper { stream_config_.encoder_factory.get()); } MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } - RtpTransportControllerSendInterface* transport() { return &fake_transport_; } + RtpTransportControllerSendInterface* transport() { return &rtp_transport_; } TimeInterval* active_lifetime() { return &active_lifetime_; } static void AddBweToConfig(AudioSendStream::Config* config) { @@ -213,11 +204,11 @@ struct ConfigHelper { EnableSendTransportSequenceNumber(kTransportSequenceNumberId)) .Times(1); EXPECT_CALL(*channel_proxy_, RegisterSenderCongestionControlObjects( - &fake_transport_, Ne(nullptr))) + &rtp_transport_, Ne(nullptr))) .Times(1); } else { EXPECT_CALL(*channel_proxy_, RegisterSenderCongestionControlObjects( - &fake_transport_, Eq(nullptr))) + &rtp_transport_, Eq(nullptr))) .Times(1); } EXPECT_CALL(*channel_proxy_, ResetSenderCongestionControlObjects()) @@ -312,11 +303,8 @@ struct ConfigHelper { AudioProcessingStats audio_processing_stats_; SimulatedClock simulated_clock_; TimeInterval active_lifetime_; - PacketRouter packet_router_; - testing::NiceMock pacer_; - std::unique_ptr send_side_cc_; - FakeRtpTransportControllerSend fake_transport_; MockRtcEventLog event_log_; + RtpTransportControllerSend rtp_transport_; MockRtpRtcp rtp_rtcp_; MockRtcpRttStats rtcp_rtt_stats_; testing::NiceMock limit_observer_;