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

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

Issue 2918323002: Add functionality which limits the number of bytes on the network. (Closed)
Patch Set: Comment addressed. Created 3 years, 4 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/paced_sender_unittest.cc
diff --git a/webrtc/modules/pacing/paced_sender_unittest.cc b/webrtc/modules/pacing/paced_sender_unittest.cc
index 5b814621c3751116ac3f11268c5a84c1b83fb961..13eb5e3dcc8d47af454dd7553b2faa346515236c 100644
--- a/webrtc/modules/pacing/paced_sender_unittest.cc
+++ b/webrtc/modules/pacing/paced_sender_unittest.cc
@@ -651,12 +651,20 @@ TEST_F(PacedSenderTest, Pause) {
EXPECT_EQ(second_capture_time_ms - capture_time_ms,
send_bucket_->QueueInMs());
- for (int i = 0; i < 10; ++i) {
- clock_.AdvanceTimeMilliseconds(5);
+ EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
+ EXPECT_CALL(callback_, TimeToSendPadding(1, _)).Times(1);
+ send_bucket_->Process();
+
+ int64_t expected_time_until_send = 500;
+ EXPECT_CALL(callback_, TimeToSendPadding(1, _)).Times(1);
+ while (expected_time_until_send >= 0) {
// TimeUntilNextProcess must not return 0 when paused. If it does,
// we risk running a busy loop, so ideally it should return a large value.
- EXPECT_GE(send_bucket_->TimeUntilNextProcess(), 1000);
- send_bucket_->Process();
+ EXPECT_EQ(expected_time_until_send, send_bucket_->TimeUntilNextProcess());
+ if (expected_time_until_send == 0)
+ send_bucket_->Process();
+ clock_.AdvanceTimeMilliseconds(5);
+ expected_time_until_send -= 5;
}
// Expect high prio packets to come out first followed by normal
@@ -699,10 +707,10 @@ TEST_F(PacedSenderTest, Pause) {
send_bucket_->Resume();
for (size_t i = 0; i < 4; i++) {
- EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
- clock_.AdvanceTimeMilliseconds(5);
EXPECT_EQ(0, send_bucket_->TimeUntilNextProcess());
send_bucket_->Process();
+ EXPECT_EQ(5, send_bucket_->TimeUntilNextProcess());
+ clock_.AdvanceTimeMilliseconds(5);
}
EXPECT_EQ(0, send_bucket_->QueueInMs());
« no previous file with comments | « webrtc/modules/pacing/paced_sender.cc ('k') | webrtc/modules/remote_bitrate_estimator/include/send_time_history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698