OLD | NEW |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); | 117 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); |
118 controller_->SignalNetworkState(kNetworkDown); | 118 controller_->SignalNetworkState(kNetworkDown); |
119 | 119 |
120 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _)); | 120 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps, _, _)); |
121 controller_->SignalNetworkState(kNetworkUp); | 121 controller_->SignalNetworkState(kNetworkUp); |
122 | 122 |
123 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); | 123 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); |
124 controller_->SignalNetworkState(kNetworkDown); | 124 controller_->SignalNetworkState(kNetworkDown); |
125 } | 125 } |
126 | 126 |
| 127 TEST_F(CongestionControllerTest, ResetBweAndBitrates) { |
| 128 int new_bitrate = 200000; |
| 129 EXPECT_CALL(observer_, OnNetworkChanged(new_bitrate, _, _)); |
| 130 EXPECT_CALL(*pacer_, SetEstimatedBitrate(new_bitrate)); |
| 131 controller_->ResetBweAndBitrates(new_bitrate, -1, -1); |
| 132 |
| 133 // If the bitrate is reset to -1, the new starting bitrate will be |
| 134 // the minimum default bitrate 10000bps. |
| 135 int min_default_bitrate = 10000; |
| 136 EXPECT_CALL(observer_, OnNetworkChanged(min_default_bitrate, _, _)); |
| 137 EXPECT_CALL(*pacer_, SetEstimatedBitrate(min_default_bitrate)); |
| 138 controller_->ResetBweAndBitrates(-1, -1, -1); |
| 139 } |
| 140 |
127 TEST_F(CongestionControllerTest, | 141 TEST_F(CongestionControllerTest, |
128 SignalNetworkStateAndQueueIsFullAndEstimateChange) { | 142 SignalNetworkStateAndQueueIsFullAndEstimateChange) { |
129 // Send queue is full | 143 // Send queue is full |
130 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) | 144 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) |
131 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1)); | 145 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1)); |
132 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); | 146 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); |
133 controller_->Process(); | 147 controller_->Process(); |
134 | 148 |
135 // Queue is full and network is down. Expect no bitrate change. | 149 // Queue is full and network is down. Expect no bitrate change. |
136 controller_->SignalNetworkState(kNetworkDown); | 150 controller_->SignalNetworkState(kNetworkDown); |
(...skipping 11 matching lines...) Expand all Loading... |
148 | 162 |
149 // Let the pacer not be full next time the controller checks. | 163 // Let the pacer not be full next time the controller checks. |
150 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) | 164 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) |
151 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1)); | 165 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1)); |
152 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _)); | 166 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _)); |
153 controller_->Process(); | 167 controller_->Process(); |
154 } | 168 } |
155 | 169 |
156 } // namespace test | 170 } // namespace test |
157 } // namespace webrtc | 171 } // namespace webrtc |
OLD | NEW |