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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc

Issue 1527003002: [rtp_rtcp] RtcpReceiverTest rewritten using public available interface (observers) instead intermid… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 10 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/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
index 183076ff59141e2cc9a3f3634588da42563dedd9..bef251c5f04a62c91a2c8cc7d9ad5235f9756c73 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
@@ -14,15 +14,16 @@
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_observer.h"
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h"
+#include "webrtc/modules/rtp_rtcp/mocks/mock_rtcp_observers.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
-#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/test/null_transport.h"
#include "webrtc/typedefs.h"
namespace webrtc {
namespace {
+using ::testing::_;
class TestTransport : public Transport {
public:
@@ -35,18 +36,7 @@ class TestTransport : public Transport {
return false;
}
bool SendRtcp(const uint8_t* packet, size_t packetLength) override {
- RTCPUtility::RTCPParserV2 rtcpParser(packet, packetLength,
- true); // Allow non-compound RTCP
-
- EXPECT_TRUE(rtcpParser.IsValid());
- RTCPHelp::RTCPPacketInformation rtcpPacketInformation;
- EXPECT_EQ(0, rtcp_receiver_->IncomingRTCPPacket(rtcpPacketInformation,
- &rtcpParser));
-
- EXPECT_EQ((uint32_t)kRtcpRemb,
- rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb);
- EXPECT_EQ((uint32_t)1234,
- rtcpPacketInformation.receiverEstimatedMaxBitrate);
+ EXPECT_TRUE(rtcp_receiver_->IncomingPacket(packet, packetLength));
return true;
}
@@ -80,6 +70,7 @@ class RtcpFormatRembTest : public ::testing::Test {
TestTransport* test_transport_;
test::NullTransport null_transport_;
MockRemoteBitrateObserver remote_bitrate_observer_;
+ MockRtcpBandwidthObserver test_bitrate_observer_;
rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
};
@@ -90,8 +81,9 @@ void RtcpFormatRembTest::SetUp() {
configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get();
configuration.outgoing_transport = &null_transport_;
dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
- rtcp_receiver_ = new RTCPReceiver(system_clock_, false, nullptr, nullptr,
- nullptr, nullptr, dummy_rtp_rtcp_impl_);
+ rtcp_receiver_ =
+ new RTCPReceiver(system_clock_, false, nullptr, &test_bitrate_observer_,
+ nullptr, nullptr, dummy_rtp_rtcp_impl_);
test_transport_ = new TestTransport(rtcp_receiver_);
rtcp_sender_ = new RTCPSender(false, system_clock_, receive_statistics_.get(),
nullptr, nullptr, test_transport_);
@@ -118,6 +110,9 @@ TEST_F(RtcpFormatRembTest, TestNonCompund) {
rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(1, SSRC));
RTCPSender::FeedbackState feedback_state =
dummy_rtp_rtcp_impl_->GetFeedbackState();
+ EXPECT_CALL(test_bitrate_observer_, OnReceivedRtcpReceiverReport(_, _, _))
+ .Times(0);
+ EXPECT_CALL(test_bitrate_observer_, OnReceivedEstimatedBitrate(1234));
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb));
}
@@ -127,6 +122,8 @@ TEST_F(RtcpFormatRembTest, TestCompund) {
rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2));
RTCPSender::FeedbackState feedback_state =
dummy_rtp_rtcp_impl_->GetFeedbackState();
+ EXPECT_CALL(test_bitrate_observer_, OnReceivedRtcpReceiverReport(_, _, _));
+ EXPECT_CALL(test_bitrate_observer_, OnReceivedEstimatedBitrate(1234));
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb));
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698