| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 |
| 11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_win
dow.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/congestion_win
dow.h" |
| 12 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/bbr.h" | 12 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/bbr.h" |
| 13 | 13 |
| 14 #include "webrtc/test/gtest.h" | 14 #include "webrtc/test/gtest.h" |
| 15 | 15 |
| 16 namespace webrtc { | 16 namespace webrtc { |
| 17 namespace testing { | 17 namespace testing { |
| 18 namespace bwe { | 18 namespace bwe { |
| 19 namespace { | 19 namespace { |
| 20 // These are the same values used in CongestionWindow class. | 20 // Same value used in CongestionWindow class. |
| 21 const int64_t kStartingCongestionWindow = 6000; | 21 const int64_t kStartingCongestionWindow = 6000; |
| 22 const int64_t kMinimumCongestionWindow = 4000; | |
| 23 } // namespace | 22 } // namespace |
| 24 | 23 |
| 25 TEST(CongestionWindowTest, InitializationCheck) { | 24 TEST(CongestionWindowTest, InitializationCheck) { |
| 26 CongestionWindow congestion_window; | 25 CongestionWindow congestion_window; |
| 27 congestion_window.PacketSent(0); | 26 congestion_window.PacketSent(0); |
| 28 EXPECT_EQ(congestion_window.data_inflight(), 0u); | 27 EXPECT_EQ(congestion_window.data_inflight(), 0u); |
| 29 congestion_window.AckReceived(0); | 28 congestion_window.AckReceived(0); |
| 30 EXPECT_EQ(congestion_window.data_inflight(), 0u); | 29 EXPECT_EQ(congestion_window.data_inflight(), 0u); |
| 31 } | 30 } |
| 32 | 31 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 } | 43 } |
| 45 | 44 |
| 46 TEST(CongestionWindowTest, ZeroBandwidthDelayProduct) { | 45 TEST(CongestionWindowTest, ZeroBandwidthDelayProduct) { |
| 47 CongestionWindow congestion_window; | 46 CongestionWindow congestion_window; |
| 48 int64_t target_congestion_window = | 47 int64_t target_congestion_window = |
| 49 congestion_window.GetTargetCongestionWindow( | 48 congestion_window.GetTargetCongestionWindow( |
| 50 100, rtc::Optional<int64_t>(0), 2.885f); | 49 100, rtc::Optional<int64_t>(0), 2.885f); |
| 51 EXPECT_EQ(target_congestion_window, 2.885f * kStartingCongestionWindow); | 50 EXPECT_EQ(target_congestion_window, 2.885f * kStartingCongestionWindow); |
| 52 } | 51 } |
| 53 | 52 |
| 54 TEST(CongestionWindowTest, BelowMinimumTargetCongestionWindow) { | |
| 55 CongestionWindow congestion_window; | |
| 56 int64_t target_congestion_window = | |
| 57 congestion_window.GetTargetCongestionWindow( | |
| 58 100, rtc::Optional<int64_t>(2), 2.885f); | |
| 59 EXPECT_EQ(target_congestion_window, kMinimumCongestionWindow); | |
| 60 } | |
| 61 | |
| 62 TEST(CongestionWindowTest, AboveMinimumTargetCongestionWindow) { | |
| 63 CongestionWindow congestion_window; | |
| 64 int64_t target_congestion_window = | |
| 65 congestion_window.GetTargetCongestionWindow( | |
| 66 100000, rtc::Optional<int64_t>(2), 2.885f); | |
| 67 EXPECT_EQ(target_congestion_window, 577000); | |
| 68 } | |
| 69 | |
| 70 TEST(CongestionWindowTest, MinimumCongestionWindow) { | |
| 71 CongestionWindow congestion_window; | |
| 72 int64_t cwnd = congestion_window.GetCongestionWindow( | |
| 73 BbrBweSender::PROBE_RTT, 100, rtc::Optional<int64_t>(100), 2.885f); | |
| 74 EXPECT_EQ(cwnd, kMinimumCongestionWindow); | |
| 75 } | |
| 76 | |
| 77 TEST(CongestionWindowTest, CalculateCongestionWindow) { | 53 TEST(CongestionWindowTest, CalculateCongestionWindow) { |
| 78 CongestionWindow congestion_window; | 54 CongestionWindow congestion_window; |
| 79 int64_t cwnd = congestion_window.GetCongestionWindow( | 55 int64_t cwnd = congestion_window.GetCongestionWindow( |
| 80 BbrBweSender::STARTUP, 100, rtc::Optional<int64_t>(100l), 2.885f); | 56 BbrBweSender::STARTUP, 800000, rtc::Optional<int64_t>(100l), 2.885f); |
| 57 EXPECT_EQ(cwnd, 28850); |
| 58 cwnd = congestion_window.GetCongestionWindow( |
| 59 BbrBweSender::STARTUP, 400000, rtc::Optional<int64_t>(200l), 2.885f); |
| 81 EXPECT_EQ(cwnd, 28850); | 60 EXPECT_EQ(cwnd, 28850); |
| 82 } | 61 } |
| 83 } // namespace bwe | 62 } // namespace bwe |
| 84 } // namespace testing | 63 } // namespace testing |
| 85 } // namespace webrtc | 64 } // namespace webrtc |
| OLD | NEW |