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

Side by Side 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: git cl format 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // Let the pacer not be full next time the controller checks. 101 // Let the pacer not be full next time the controller checks.
102 // |OnNetworkChanged| should be called with the new estimate. 102 // |OnNetworkChanged| should be called with the new estimate.
103 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) 103 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
104 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1)); 104 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
105 EXPECT_CALL(observer_, OnNetworkChanged(initial_bitrate_bps_ * 2, _, _)); 105 EXPECT_CALL(observer_, OnNetworkChanged(initial_bitrate_bps_ * 2, _, _));
106 clock_.AdvanceTimeMilliseconds(25); 106 clock_.AdvanceTimeMilliseconds(25);
107 controller_->Process(); 107 controller_->Process();
108 } 108 }
109 109
110 TEST_F(CongestionControllerTest, SignalNetworkState) {
111 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
112 controller_->SignalNetworkState(kNetworkDown);
113 controller_->Process();
114
115 EXPECT_CALL(observer_, OnNetworkChanged(initial_bitrate_bps_, _, _));
116 controller_->SignalNetworkState(kNetworkUp);
117 controller_->Process();
118
119 EXPECT_CALL(observer_, OnNetworkChanged(initial_bitrate_bps_, _, _));
120 controller_->SignalNetworkState(kNetworkDown);
121 controller_->SignalNetworkState(kNetworkUp);
122 controller_->Process();
123
124 controller_->SignalNetworkState(kNetworkDown);
125 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
126 controller_->Process();
127
128 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
129 controller_->SignalNetworkState(kNetworkUp);
130 controller_->SignalNetworkState(kNetworkDown);
131 controller_->Process();
132 }
133
134 TEST_F(CongestionControllerTest,
135 SignalNetworkStateAndQueueIsFullAndEstimateChange) {
136 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
137 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1));
138 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
139 controller_->Process();
140
141 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
142 controller_->SignalNetworkState(kNetworkDown);
143 controller_->Process();
144
145 // Queue is full. Expect zero bitrate even when the network is up.
146 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
147 controller_->SignalNetworkState(kNetworkUp);
148 controller_->Process();
149
150 // Receive new estimate but let the queue still be full.
151 bandwidth_observer_->OnReceivedEstimatedBitrate(initial_bitrate_bps_ * 2);
152 clock_.AdvanceTimeMilliseconds(25);
153 controller_->Process();
154
155 // Let the pacer not be full next time the controller checks.
156 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
157 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
158 EXPECT_CALL(observer_, OnNetworkChanged(initial_bitrate_bps_ * 2, _, _));
159 controller_->Process();
160 }
161
110 } // namespace test 162 } // namespace test
111 } // namespace webrtc 163 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698