| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 79 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 80 | 80 |
| 81 // Stay in non-ALR state when usage is close to 100%. | 81 // Stay in non-ALR state when usage is close to 100%. |
| 82 SimulateOutgoingTrafficIn(&alr_detector_) | 82 SimulateOutgoingTrafficIn(&alr_detector_) |
| 83 .ForTimeMs(1000) | 83 .ForTimeMs(1000) |
| 84 .AtPercentOfEstimatedBitrate(90); | 84 .AtPercentOfEstimatedBitrate(90); |
| 85 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 85 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 86 | 86 |
| 87 // Verify that we ALR starts when bitrate drops below 20%. | 87 // Verify that we ALR starts when bitrate drops below 20%. |
| 88 SimulateOutgoingTrafficIn(&alr_detector_) | 88 SimulateOutgoingTrafficIn(&alr_detector_) |
| 89 .ForTimeMs(1000) | 89 .ForTimeMs(1500) |
| 90 .AtPercentOfEstimatedBitrate(20); | 90 .AtPercentOfEstimatedBitrate(20); |
| 91 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 91 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 92 | 92 |
| 93 // Verify that ALR ends when usage is above 65%. | 93 // Verify that ALR ends when usage is above 65%. |
| 94 SimulateOutgoingTrafficIn(&alr_detector_) | 94 SimulateOutgoingTrafficIn(&alr_detector_) |
| 95 .ForTimeMs(1000) | 95 .ForTimeMs(1000) |
| 96 .AtPercentOfEstimatedBitrate(100); | 96 .AtPercentOfEstimatedBitrate(100); |
| 97 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 97 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST_F(AlrDetectorTest, ShortSpike) { | 100 TEST_F(AlrDetectorTest, ShortSpike) { |
| 101 // Start in non-ALR state. | 101 // Start in non-ALR state. |
| 102 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 102 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 103 | 103 |
| 104 // Verify that we ALR starts when bitrate drops below 20%. | 104 // Verify that we ALR starts when bitrate drops below 20%. |
| 105 SimulateOutgoingTrafficIn(&alr_detector_) | 105 SimulateOutgoingTrafficIn(&alr_detector_) |
| 106 .ForTimeMs(1000) | 106 .ForTimeMs(1000) |
| 107 .AtPercentOfEstimatedBitrate(20); | 107 .AtPercentOfEstimatedBitrate(20); |
| 108 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 108 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 109 | 109 |
| 110 // Verify that we stay in ALR region even after a short bitrate spike. | 110 // Verify that we stay in ALR region even after a short bitrate spike. |
| 111 SimulateOutgoingTrafficIn(&alr_detector_) | 111 SimulateOutgoingTrafficIn(&alr_detector_) |
| 112 .ForTimeMs(200) | 112 .ForTimeMs(100) |
| 113 .AtPercentOfEstimatedBitrate(150); | 113 .AtPercentOfEstimatedBitrate(150); |
| 114 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 114 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 115 | 115 |
| 116 // ALR ends when usage is above 65%. | 116 // ALR ends when usage is above 65%. |
| 117 SimulateOutgoingTrafficIn(&alr_detector_) | 117 SimulateOutgoingTrafficIn(&alr_detector_) |
| 118 .ForTimeMs(1000) | 118 .ForTimeMs(1000) |
| 119 .AtPercentOfEstimatedBitrate(100); | 119 .AtPercentOfEstimatedBitrate(100); |
| 120 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 120 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 121 } | 121 } |
| 122 | 122 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 136 // to the BWE drop by initiating a new probe. | 136 // to the BWE drop by initiating a new probe. |
| 137 alr_detector_.SetEstimatedBitrate(kEstimatedBitrateBps / 5); | 137 alr_detector_.SetEstimatedBitrate(kEstimatedBitrateBps / 5); |
| 138 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 138 EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 139 SimulateOutgoingTrafficIn(&alr_detector_) | 139 SimulateOutgoingTrafficIn(&alr_detector_) |
| 140 .ForTimeMs(1000) | 140 .ForTimeMs(1000) |
| 141 .AtPercentOfEstimatedBitrate(50); | 141 .AtPercentOfEstimatedBitrate(50); |
| 142 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); | 142 EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace webrtc | 145 } // namespace webrtc |
| OLD | NEW |