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

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

Issue 2503643003: More reliable ALR detection (Closed)
Patch Set: Created 4 years, 1 month 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 a30f9fa86329b5cf0957ef40274bd40c31cd198c..e422fed5e2143566ed851a4600439153102950b7 100644
--- a/webrtc/modules/pacing/alr_detector_unittest.cc
+++ b/webrtc/modules/pacing/alr_detector_unittest.cc
@@ -24,25 +24,30 @@ namespace webrtc {
TEST(AlrDetectorTest, ApplicationLimitedWhenLittleDataSent) {
AlrDetector alr_detector;
-
+ int now_ms = 0;
alr_detector.SetEstimatedBitrate(kEstimatedBitrateBps);
- for (int i = 0; i < 6; i++)
- alr_detector.OnBytesSent(0, kMeasuredIntervalMs);
- EXPECT_EQ(alr_detector.InApplicationLimitedRegion(), true);
-
- for (int i = 0; i < 6; i++)
- alr_detector.OnBytesSent(100, kMeasuredIntervalMs);
- EXPECT_EQ(alr_detector.InApplicationLimitedRegion(), true);
+ for (int i = 0; i < 6; i++) {
+ now_ms += kMeasuredIntervalMs;
+ alr_detector.OnBytesSent(0, now_ms);
+ }
+ EXPECT_TRUE(alr_detector.InApplicationLimitedRegion());
+
+ for (int i = 0; i < 6; i++) {
+ now_ms += kMeasuredIntervalMs;
+ alr_detector.OnBytesSent(100, now_ms);
+ }
+ EXPECT_TRUE(alr_detector.InApplicationLimitedRegion());
}
TEST(AlrDetectorTest, NetworkLimitedWhenSendingCloseToEstimate) {
AlrDetector alr_detector;
-
+ int64_t now_ms = 0;
alr_detector.SetEstimatedBitrate(kEstimatedBitrateBps);
- for (int i = 0; i < 6; i++)
- alr_detector.OnBytesSent(kBytesInIntervalAtEstimatedBitrate,
- kMeasuredIntervalMs);
- EXPECT_EQ(alr_detector.InApplicationLimitedRegion(), false);
+ for (int i = 0; i < 6; i++) {
+ now_ms += kMeasuredIntervalMs;
+ alr_detector.OnBytesSent(kBytesInIntervalAtEstimatedBitrate, now_ms);
+ }
+ EXPECT_FALSE(alr_detector.InApplicationLimitedRegion());
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698