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

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

Issue 2458863002: Start probes only after network is connected. (Closed)
Patch Set: . Created 4 years, 2 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 91508df26564815691f2ede44f60f991e7f69e47..7d9ed4b4c26725e5ddad91111fe8251d2512db1d 100644
--- a/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/congestion_controller_unittest.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/base/networkroute.h"
#include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/congestion_controller.h"
@@ -117,29 +118,19 @@ TEST_F(CongestionControllerTest, OnSendQueueFullAndEstimateChange) {
controller_->Process();
}
-TEST_F(CongestionControllerTest, SignalNetworkState) {
+TEST_F(CongestionControllerTest, OnNetworkRouteChanged) {
EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
- controller_->SignalNetworkState(kNetworkDown);
+ rtc::NetworkRoute route;
+ route.connected = false;
+ controller_->OnNetworkRouteChanged(route);
EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
- controller_->SignalNetworkState(kNetworkUp);
+ route.connected = true;
+ controller_->OnNetworkRouteChanged(route);
EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
- controller_->SignalNetworkState(kNetworkDown);
-}
-
-TEST_F(CongestionControllerTest, ResetBweAndBitrates) {
- int new_bitrate = 200000;
- 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 10000bps.
- int min_default_bitrate = 10000;
- EXPECT_CALL(observer_, OnNetworkChanged(min_default_bitrate, _, _));
- EXPECT_CALL(*pacer_, SetEstimatedBitrate(min_default_bitrate));
- controller_->ResetBweAndBitrates(-1, -1, -1);
+ route.connected = false;
+ controller_->OnNetworkRouteChanged(route);
}
TEST_F(CongestionControllerTest,
@@ -151,11 +142,14 @@ TEST_F(CongestionControllerTest,
controller_->Process();
// Queue is full and network is down. Expect no bitrate change.
- controller_->SignalNetworkState(kNetworkDown);
+ rtc::NetworkRoute route;
+ route.connected = false;
+ controller_->OnNetworkRouteChanged(route);
controller_->Process();
// Queue is full but network is up. Expect no bitrate change.
- controller_->SignalNetworkState(kNetworkUp);
+ route.connected = true;
+ controller_->OnNetworkRouteChanged(route);
controller_->Process();
// Receive new estimate but let the queue still be full.
@@ -179,11 +173,14 @@ TEST_F(CongestionControllerTest, GetPacerQueuingDelayMs) {
EXPECT_EQ(kQueueTimeMs, controller_->GetPacerQueuingDelayMs());
// Expect zero pacer delay when network is down.
- controller_->SignalNetworkState(kNetworkDown);
+ rtc::NetworkRoute route;
+ route.connected = false;
+ controller_->OnNetworkRouteChanged(route);
EXPECT_EQ(0, controller_->GetPacerQueuingDelayMs());
// Network is up, pacer delay should be reported.
- controller_->SignalNetworkState(kNetworkUp);
+ route.connected = true;
+ controller_->OnNetworkRouteChanged(route);
EXPECT_EQ(kQueueTimeMs, controller_->GetPacerQueuingDelayMs());
}

Powered by Google App Engine
This is Rietveld 408576698