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

Unified Diff: webrtc/modules/congestion_controller/congestion_controller_unittest.cc

Issue 2518923003: Pass time constant to bwe smoothing filter. (Closed)
Patch Set: Add probing_interval_ms to NullBitrateObserver. Created 4 years, 1 month 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/congestion_controller/congestion_controller_unittest.cc
diff --git a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
index 42bb5267b2f2bbe8d92aa438cd5bd068847061f5..a72d80bbb31ddaa4a1d03789cef2d6a98f3e4513 100644
--- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
@@ -46,7 +46,7 @@ class CongestionControllerTest : public ::testing::Test {
// Set the initial bitrate estimate and expect the |observer| and |pacer_|
// to be updated.
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _));
EXPECT_CALL(*pacer_, SetEstimatedBitrate(kInitialBitrateBps));
controller_->SetBweBitrates(0, kInitialBitrateBps, 5 * kInitialBitrateBps);
}
@@ -66,13 +66,13 @@ TEST_F(CongestionControllerTest, OnNetworkChanged) {
clock_.AdvanceTimeMilliseconds(25);
controller_->Process();
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _, _));
EXPECT_CALL(*pacer_, SetEstimatedBitrate(kInitialBitrateBps * 2));
bandwidth_observer_->OnReceivedEstimatedBitrate(kInitialBitrateBps * 2);
clock_.AdvanceTimeMilliseconds(25);
controller_->Process();
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _));
EXPECT_CALL(*pacer_, SetEstimatedBitrate(kInitialBitrateBps));
bandwidth_observer_->OnReceivedEstimatedBitrate(kInitialBitrateBps);
clock_.AdvanceTimeMilliseconds(25);
@@ -83,21 +83,21 @@ TEST_F(CongestionControllerTest, OnSendQueueFull) {
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
.WillOnce(Return(PacedSender::kMaxQueueLengthMs + 1));
- EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
controller_->Process();
// Let the pacer not be full next time the controller checks.
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
.WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _));
controller_->Process();
}
TEST_F(CongestionControllerTest, OnSendQueueFullAndEstimateChange) {
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
.WillOnce(Return(PacedSender::kMaxQueueLengthMs + 1));
- EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
controller_->Process();
// Receive new estimate but let the queue still be full.
@@ -113,32 +113,33 @@ TEST_F(CongestionControllerTest, OnSendQueueFullAndEstimateChange) {
// |OnNetworkChanged| should be called with the new estimate.
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
.WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _, _));
clock_.AdvanceTimeMilliseconds(25);
controller_->Process();
}
TEST_F(CongestionControllerTest, SignalNetworkState) {
- EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
controller_->SignalNetworkState(kNetworkDown);
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _, _));
controller_->SignalNetworkState(kNetworkUp);
- EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
controller_->SignalNetworkState(kNetworkDown);
}
TEST_F(CongestionControllerTest, ResetBweAndBitrates) {
int new_bitrate = 200000;
- EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _, _));
EXPECT_CALL(*pacer_, SetEstimatedBitrate(new_bitrate));
controller_->ResetBweAndBitrates(new_bitrate, -1, -1);
// If the bitrate is reset to -1, the new starting bitrate will be
// the minimum default bitrate kMinBitrateBps.
- EXPECT_CALL(observer_, OnNetworkChanged(
- congestion_controller::GetMinBitrateBps(), _, _));
+ EXPECT_CALL(
+ observer_,
+ OnNetworkChanged(congestion_controller::GetMinBitrateBps(), _, _, _));
EXPECT_CALL(*pacer_,
SetEstimatedBitrate(congestion_controller::GetMinBitrateBps()));
controller_->ResetBweAndBitrates(-1, -1, -1);
@@ -149,7 +150,7 @@ TEST_F(CongestionControllerTest,
// Send queue is full
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
.WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1));
- EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _, _));
controller_->Process();
// Queue is full and network is down. Expect no bitrate change.
@@ -169,12 +170,12 @@ TEST_F(CongestionControllerTest,
// Let the pacer not be full next time the controller checks.
EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
.WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
- EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _));
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _, _));
controller_->Process();
}
TEST_F(CongestionControllerTest, GetPacerQueuingDelayMs) {
- EXPECT_CALL(observer_, OnNetworkChanged(_, _, _)).Times(AtLeast(1));
+ EXPECT_CALL(observer_, OnNetworkChanged(_, _, _, _)).Times(AtLeast(1));
const int64_t kQueueTimeMs = 123;
EXPECT_CALL(*pacer_, QueueInMs()).WillRepeatedly(Return(kQueueTimeMs));
@@ -189,5 +190,16 @@ TEST_F(CongestionControllerTest, GetPacerQueuingDelayMs) {
EXPECT_EQ(kQueueTimeMs, controller_->GetPacerQueuingDelayMs());
}
+TEST_F(CongestionControllerTest, GetProbingInterval) {
+ clock_.AdvanceTimeMilliseconds(25);
+ controller_->Process();
+
+ EXPECT_CALL(observer_, OnNetworkChanged(_, _, _, testing::Ne(0)));
+ EXPECT_CALL(*pacer_, SetEstimatedBitrate(_));
+ bandwidth_observer_->OnReceivedEstimatedBitrate(kInitialBitrateBps * 2);
+ clock_.AdvanceTimeMilliseconds(25);
+ controller_->Process();
+}
+
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698