Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1594)

Unified Diff: webrtc/modules/pacing/alr_detector_unittest.cc

Issue 2970653004: Reimplemeted "Test and fix for huge bwe drop after alr state" (Closed)
Patch Set: Fix uninitialized variable Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698