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

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: Response to comments 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..dab9477e2eb2e9de424abcce15806aab5db654c8 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"
#include "webrtc/test/gtest.h"
namespace {
constexpr int kEstimatedBitrateBps = 300000;
+// constexpr int64_t kAlrEndedTimeMs = 1234;
} // 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,23 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
EXPECT_FALSE(alr_detector_.GetApplicationLimitedRegionStartTime());
}
+TEST(AlrStateTest, NotStateChangeWhenNoStartTimeProvided) {
+ AlrState alr_state;
+ EXPECT_EQ(alr_state.ChangeWhenAlrStartTimeIs(rtc::Optional<int64_t>()),
+ AlrState::Change::kNoChange);
+}
+
+TEST(AlrStateTest, StateChangeToAlr) {
+ AlrState alr_state;
+ EXPECT_EQ(alr_state.ChangeWhenAlrStartTimeIs(rtc::Optional<int64_t>(10)),
+ AlrState::Change::kStarted);
+}
+
+TEST(AlrStateTest, StateChangeToNoAlr) {
+ AlrState alr_state;
+ alr_state.ChangeWhenAlrStartTimeIs(rtc::Optional<int64_t>(10));
+ EXPECT_EQ(alr_state.ChangeWhenAlrStartTimeIs(rtc::Optional<int64_t>()),
+ AlrState::Change::kEnded);
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698