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

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: 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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // Let the pacer not be full next time the controller checks. 107 // Let the pacer not be full next time the controller checks.
108 // |OnNetworkChanged| should be called with the new estimate. 108 // |OnNetworkChanged| should be called with the new estimate.
109 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) 109 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
110 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1)); 110 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
111 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _)); 111 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _));
112 clock_.AdvanceTimeMilliseconds(25); 112 clock_.AdvanceTimeMilliseconds(25);
113 controller_->Process(); 113 controller_->Process();
114 } 114 }
115 115
116 TEST_F(CongestionControllerTest, SignalNetworkState) {
117 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
118 controller_->SignalNetworkState(kNetworkDown);
119
120 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _));
121 controller_->SignalNetworkState(kNetworkUp);
122
123 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
124 controller_->SignalNetworkState(kNetworkDown);
125 }
126
127 TEST_F(CongestionControllerTest,
128 SignalNetworkStateAndQueueIsFullAndEstimateChange) {
129 // Send queue is full
130 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
131 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1));
132 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _));
133 controller_->Process();
134
135 // Queue is full and network is down. Expect no bitrate change.
136 controller_->SignalNetworkState(kNetworkDown);
137 controller_->Process();
138
139 // Queue is full but network is up. Expect no bitrate change.
140 controller_->SignalNetworkState(kNetworkUp);
141 controller_->Process();
142
143 // Receive new estimate but let the queue still be full.
144 EXPECT_CALL(*pacer_, SetEstimatedBitrate(kInitialBitrateBps * 2));
145 bandwidth_observer_->OnReceivedEstimatedBitrate(kInitialBitrateBps * 2);
146 clock_.AdvanceTimeMilliseconds(25);
147 controller_->Process();
148
149 // Let the pacer not be full next time the controller checks.
150 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs())
151 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1));
152 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _));
153 controller_->Process();
154 }
155
116 } // namespace test 156 } // namespace test
117 } // namespace webrtc 157 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698