From caeae4680c74fb9786cdf536804f40e9d2d4e864 Mon Sep 17 00:00:00 2001 From: "solenberg@webrtc.org" Date: Mon, 31 Mar 2014 13:33:39 +0000 Subject: [PATCH] Add tests for the RBE RemoveStream() API. BUG= R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/10929004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5812 4adac7df-926f-26a2-2b94-8c16560cd09d --- ...emote_bitrate_estimator_unittest_helper.cc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc index af8a6729f3..dc30d9334b 100644 --- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc +++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.cc @@ -341,6 +341,10 @@ void RemoteBitrateEstimatorTest::InitialBehaviorTestHelper( EXPECT_TRUE(bitrate_observer_->updated()); bitrate_observer_->Reset(); EXPECT_EQ(bitrate_observer_->latest_bitrate(), bitrate_bps); + bitrate_estimator_->RemoveStream(kDefaultSsrc); + EXPECT_TRUE(bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_bps)); + ASSERT_EQ(0u, ssrcs.size()); + EXPECT_EQ(0u, bitrate_bps); } void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper( @@ -487,5 +491,21 @@ void RemoteBitrateEstimatorTest::CapacityDropTestHelper( EXPECT_EQ(expected_bitrate_drop_delta, bitrate_drop_time - overuse_start_time); + + // Remove stream one by one. + unsigned int latest_bps = 0; + std::vector ssrcs; + for (int i = 0; i < number_of_streams; i++) { + EXPECT_TRUE(bitrate_estimator_->LatestEstimate(&ssrcs, &latest_bps)); + EXPECT_EQ(number_of_streams - i, static_cast(ssrcs.size())); + EXPECT_EQ(bitrate_bps, latest_bps); + for (int j = i; j < number_of_streams; j++) { + EXPECT_EQ(kDefaultSsrc + j, ssrcs[j - i]); + } + bitrate_estimator_->RemoveStream(kDefaultSsrc + i); + } + EXPECT_TRUE(bitrate_estimator_->LatestEstimate(&ssrcs, &latest_bps)); + EXPECT_EQ(0u, ssrcs.size()); + EXPECT_EQ(0u, latest_bps); } } // namespace webrtc