Index: webrtc/modules/pacing/alr_detector_unittest.cc |
diff --git a/webrtc/modules/pacing/alr_detector_unittest.cc b/webrtc/modules/pacing/alr_detector_unittest.cc |
index e1a78103dfa235b8333b1529af6fbe59267b43b9..45d90063d5deef9b0a415a3c467c68bd7cdc0c30 100644 |
--- a/webrtc/modules/pacing/alr_detector_unittest.cc |
+++ b/webrtc/modules/pacing/alr_detector_unittest.cc |
@@ -10,11 +10,13 @@ |
#include "webrtc/modules/pacing/alr_detector.h" |
+#include "webrtc/rtc_base/fakeclock.h" |
philipel
2017/07/14 13:56:23
Used?
tschumi
2017/07/14 15:36:51
Removed
|
#include "webrtc/test/gtest.h" |
namespace { |
constexpr int kEstimatedBitrateBps = 300000; |
+// constexpr int64_t kAlrEndedTimeMs = 1234; |
philipel
2017/07/14 13:56:23
remove
tschumi
2017/07/14 15:36:51
Done.
|
} // namespace |
@@ -86,7 +88,7 @@ TEST_F(AlrDetectorTest, AlrDetection) { |
// Verify that we ALR starts when bitrate drops below 20%. |
SimulateOutgoingTrafficIn(&alr_detector_) |
- .ForTimeMs(1000) |
+ .ForTimeMs(1500) |
.AtPercentOfEstimatedBitrate(20); |
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
@@ -109,7 +111,7 @@ TEST_F(AlrDetectorTest, ShortSpike) { |
// Verify that we stay in ALR region even after a short bitrate spike. |
SimulateOutgoingTrafficIn(&alr_detector_) |
- .ForTimeMs(200) |
+ .ForTimeMs(100) |
.AtPercentOfEstimatedBitrate(150); |
EXPECT_TRUE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
@@ -142,4 +144,25 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) { |
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime()); |
} |
+TEST(AlrStateTest, NotStateChangeWhenNoStartTimeProvided) { |
+ AlrState alr_state; |
+ EXPECT_FALSE(alr_state.HasChangedTo(AlrState::State::kNotInAlr)); |
+ EXPECT_FALSE(alr_state.HasChangedTo(AlrState::State::kInAlr)); |
+} |
+ |
+TEST(AlrStateTest, StateChangeToInAlr) { |
+ AlrState alr_state; |
+ alr_state.Update(rtc::Optional<int64_t>(10)); |
+ EXPECT_FALSE(alr_state.HasChangedTo(AlrState::State::kNotInAlr)); |
+ EXPECT_TRUE(alr_state.HasChangedTo(AlrState::State::kInAlr)); |
+} |
+ |
+TEST(AlrStateTest, StateChangeToNotInAlr) { |
+ AlrState alr_state; |
+ alr_state.Update(rtc::Optional<int64_t>(10)); |
+ alr_state.Update(rtc::Optional<int64_t>()); |
+ EXPECT_TRUE(alr_state.HasChangedTo(AlrState::State::kNotInAlr)); |
+ EXPECT_FALSE(alr_state.HasChangedTo(AlrState::State::kInAlr)); |
+} |
+ |
} // namespace webrtc |