| 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 | |
| 141 TEST_F(CongestionControllerTest, | 127 TEST_F(CongestionControllerTest, |
| 142 SignalNetworkStateAndQueueIsFullAndEstimateChange) { | 128 SignalNetworkStateAndQueueIsFullAndEstimateChange) { |
| 143 // Send queue is full | 129 // Send queue is full |
| 144 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) | 130 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) |
| 145 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1)); | 131 .WillRepeatedly(Return(PacedSender::kMaxQueueLengthMs + 1)); |
| 146 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); | 132 EXPECT_CALL(observer_, OnNetworkChanged(0, _, _)); |
| 147 controller_->Process(); | 133 controller_->Process(); |
| 148 | 134 |
| 149 // Queue is full and network is down. Expect no bitrate change. | 135 // Queue is full and network is down. Expect no bitrate change. |
| 150 controller_->SignalNetworkState(kNetworkDown); | 136 controller_->SignalNetworkState(kNetworkDown); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 162 | 148 |
| 163 // Let the pacer not be full next time the controller checks. | 149 // Let the pacer not be full next time the controller checks. |
| 164 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) | 150 EXPECT_CALL(*pacer_, ExpectedQueueTimeMs()) |
| 165 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1)); | 151 .WillOnce(Return(PacedSender::kMaxQueueLengthMs - 1)); |
| 166 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _)); | 152 EXPECT_CALL(observer_, OnNetworkChanged(kInitialBitrateBps * 2, _, _)); |
| 167 controller_->Process(); | 153 controller_->Process(); |
| 168 } | 154 } |
| 169 | 155 |
| 170 } // namespace test | 156 } // namespace test |
| 171 } // namespace webrtc | 157 } // namespace webrtc |
| OLD | NEW |