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

Unified Diff: webrtc/modules/congestion_controller/probe_controller_unittest.cc

Issue 2574533002: Fix integer overflow in ProbeController. (Closed)
Patch Set: Created 4 years 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/congestion_controller/probe_controller_unittest.cc
diff --git a/webrtc/modules/congestion_controller/probe_controller_unittest.cc b/webrtc/modules/congestion_controller/probe_controller_unittest.cc
index 61ca559a5364ae928ff5d8d023700f0d052e4671..6d025282bcadd2b62dc62fa4bfc3919123f9bcaa 100644
--- a/webrtc/modules/congestion_controller/probe_controller_unittest.cc
+++ b/webrtc/modules/congestion_controller/probe_controller_unittest.cc
@@ -83,8 +83,8 @@ TEST_F(ProbeControllerTest, TestExponentialProbing) {
probe_controller_->SetBitrates(kMinBitrateBps, kStartBitrateBps,
kMaxBitrateBps);
- // Repeated probe should only be sent when estimated bitrate climbs above 4 *
- // kStartBitrateBps = 1200.
+ // Repeated probe should only be sent when estimated bitrate climbs above
+ // 0.7 * 6 * kStartBitrateBps = 1260.
EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0);
probe_controller_->SetEstimatedBitrate(1000);
testing::Mock::VerifyAndClearExpectations(&pacer_);
@@ -160,5 +160,19 @@ TEST_F(ProbeControllerTest, PeriodicProbing) {
testing::Mock::VerifyAndClearExpectations(&pacer_);
}
+TEST_F(ProbeControllerTest, TestExponentialProbingOverflow) {
+ int kMbps = 1000000;
+ probe_controller_->SetBitrates(kMinBitrateBps, 10 * kMbps, 100 * kMbps);
+
+ // Verify that probe bitrate is capped at the specified max bitrate
+ EXPECT_CALL(pacer_, CreateProbeCluster(100 * kMbps, _));
+ probe_controller_->SetEstimatedBitrate(60 * kMbps);
+ testing::Mock::VerifyAndClearExpectations(&pacer_);
+
+ // Verify that repeated probes aren't sent.
+ EXPECT_CALL(pacer_, CreateProbeCluster(_, _)).Times(0);
+ probe_controller_->SetEstimatedBitrate(100 * kMbps);
+}
+
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698