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

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: Addressed comments Created 4 years, 8 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 a86e43329ba55a76aac55aaab7a9ac65ef7865f3..cf4fc6a5c2e0a548f9281a618b7e6f61a5c4946f 100644
--- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
@@ -107,5 +107,54 @@ TEST_F(CongestionControllerTest, OnSendQueueFullAndEstimateChange) {
controller_->Process();
}
+TEST_F(CongestionControllerTest, SignalNetworkState) {
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ controller_->SignalNetworkState(kNetworkDown);
+ controller_->Process();
+
+ EXPECT_CALL(observer_, OnNetworkChanged(initial_bitrate_bps_, _, _));
+ controller_->SignalNetworkState(kNetworkUp);
+ controller_->Process();
+
+ controller_->SignalNetworkState(kNetworkDown);
+ controller_->SignalNetworkState(kNetworkUp);
+ controller_->Process();
+
+ controller_->SignalNetworkState(kNetworkDown);
+ EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
+ controller_->Process();
+
+ controller_->SignalNetworkState(kNetworkUp);
+ controller_->SignalNetworkState(kNetworkDown);
+ controller_->Process();
+}
+
+TEST_F(CongestionControllerTest,
+ SignalNetworkStateAndQueueIsFullAndEstimateChange) {
+ 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.
+ bandwidth_observer_->OnReceivedEstimatedBitrate(initial_bitrate_bps_ * 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(initial_bitrate_bps_ * 2, _, _));
+ controller_->Process();
+}
+
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698