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

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

Issue 2609113003: BitrateProber::CreateProbeCluster now only accept one parameter (bitrate_bps). (Closed)
Patch Set: static_cast<int> + PacedSenderTest fix. Created 3 years, 11 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
« no previous file with comments | « webrtc/modules/pacing/bitrate_prober.cc ('k') | webrtc/modules/pacing/mock/mock_paced_sender.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/pacing/bitrate_prober_unittest.cc
diff --git a/webrtc/modules/pacing/bitrate_prober_unittest.cc b/webrtc/modules/pacing/bitrate_prober_unittest.cc
index fb353aaeab15928460e1409dfa941871db4dec73..8ac352de0e0d27facf2d610e84051b19831653bd 100644
--- a/webrtc/modules/pacing/bitrate_prober_unittest.cc
+++ b/webrtc/modules/pacing/bitrate_prober_unittest.cc
@@ -21,8 +21,8 @@ TEST(BitrateProberTest, VerifyStatesAndTimeBetweenProbes) {
int64_t now_ms = 0;
EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms));
- prober.CreateProbeCluster(900000, 6);
- prober.CreateProbeCluster(1800000, 5);
+ prober.CreateProbeCluster(900000);
+ prober.CreateProbeCluster(1800000);
EXPECT_FALSE(prober.IsProbing());
prober.OnIncomingPacket(1000);
@@ -33,7 +33,7 @@ TEST(BitrateProberTest, VerifyStatesAndTimeBetweenProbes) {
EXPECT_EQ(0, prober.TimeUntilNextProbe(now_ms));
prober.ProbeSent(now_ms, 1000);
- for (int i = 0; i < 5; ++i) {
+ for (int i = 0; i < 4; ++i) {
EXPECT_EQ(8, prober.TimeUntilNextProbe(now_ms));
now_ms += 4;
EXPECT_EQ(4, prober.TimeUntilNextProbe(now_ms));
@@ -60,7 +60,7 @@ TEST(BitrateProberTest, DoesntProbeWithoutRecentPackets) {
int64_t now_ms = 0;
EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms));
- prober.CreateProbeCluster(900000, 6);
+ prober.CreateProbeCluster(900000);
EXPECT_FALSE(prober.IsProbing());
prober.OnIncomingPacket(1000);
@@ -97,9 +97,44 @@ TEST(BitrateProberTest, VerifyProbeSizeOnHighBitrate) {
BitrateProber prober;
constexpr unsigned kHighBitrateBps = 10000000; // 10 Mbps
- prober.CreateProbeCluster(kHighBitrateBps, 6);
+ prober.CreateProbeCluster(kHighBitrateBps);
// Probe size should ensure a minimum of 1 ms interval.
EXPECT_GT(prober.RecommendedMinProbeSize(), kHighBitrateBps / 8000);
}
+TEST(BitrateProberTest, MinumumNumberOfProbingPackets) {
+ BitrateProber prober;
+ // Even when probing at a low bitrate we expect a minimum number
+ // of packets to be sent.
+ constexpr int kBitrateBps = 100000; // 100 kbps
+ constexpr int kPacketSizeBytes = 1000;
+
+ prober.CreateProbeCluster(kBitrateBps);
+ prober.OnIncomingPacket(kPacketSizeBytes);
+ for (int i = 0; i < 5; ++i) {
+ EXPECT_TRUE(prober.IsProbing());
+ prober.ProbeSent(0, kPacketSizeBytes);
+ }
+
+ EXPECT_FALSE(prober.IsProbing());
+}
+
+TEST(BitrateProberTest, ScaleBytesUsedForProbing) {
+ BitrateProber prober;
+ constexpr int kBitrateBps = 10000000; // 10 Mbps
+ constexpr int kPacketSizeBytes = 1000;
+ constexpr int kExpectedBytesSent = kBitrateBps * 15 / 8000;
+
+ prober.CreateProbeCluster(kBitrateBps);
+ prober.OnIncomingPacket(kPacketSizeBytes);
+ int bytes_sent = 0;
+ while (bytes_sent < kExpectedBytesSent) {
+ EXPECT_TRUE(prober.IsProbing());
+ prober.ProbeSent(0, kPacketSizeBytes);
+ bytes_sent += kPacketSizeBytes;
+ }
+
+ EXPECT_FALSE(prober.IsProbing());
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/modules/pacing/bitrate_prober.cc ('k') | webrtc/modules/pacing/mock/mock_paced_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698