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

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

Issue 1932683002: Remove ViEEncoder::SetNetworkStatus (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_pacer
Patch Set: Rebased and fixed CongestionController unittests. Created 4 years, 7 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/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 20bf1a88e62ae5a0cda13241dec5ea874be8dad8..c82c75daf3cdd5f6f794cb26a5f715947d02ba3d 100644
--- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
@@ -113,5 +113,45 @@ TEST_F(CongestionControllerTest, OnSendQueueFullAndEstimateChange) {
controller_->Process();
}
+TEST_F(CongestionControllerTest, SignalNetworkState) {
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ controller_->SignalNetworkState(kNetworkDown);
+
+ EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
+ controller_->SignalNetworkState(kNetworkUp);
+
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ controller_->SignalNetworkState(kNetworkDown);
+}
+
+TEST_F(CongestionControllerTest,
+ SignalNetworkStateAndQueueIsFullAndEstimateChange) {
+ // Send queue is full
+ EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
+ .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1));
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ controller_->Process();
+
+ // Queue is full and network is down. Expect no bitrate change.
+ controller_->SignalNetworkState(kNetworkDown);
+ controller_->Process();
+
+ // Queue is full but network is up. Expect no bitrate change.
+ controller_->SignalNetworkState(kNetworkUp);
+ controller_->Process();
+
+ // Receive new estimate but let the queue still be full.
+ EXPECT_CALL(*pacer_, SetEstimatedBitrate(kInitialBitrateBps * 2));
+ bandwidth_observer_->OnReceivedEstimatedBitrate(kInitialBitrateBps * 2);
+ clock_.AdvanceTimeMilliseconds(25);
+ 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 * 2, _, _));
+ controller_->Process();
+}
+
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698