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

Unified Diff: net/quic/quic_ack_notifier_test.cc

Issue 242593002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Use uint32 instead of int Created 6 years, 8 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 | « net/quic/quic_ack_notifier_manager.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_ack_notifier_test.cc
diff --git a/net/quic/quic_ack_notifier_test.cc b/net/quic/quic_ack_notifier_test.cc
index c05e63ecb72af62a7c2a6421fb0640e97c4fc01f..63bc25405b46e81d97727551f0b6b0430f8b877d 100644
--- a/net/quic/quic_ack_notifier_test.cc
+++ b/net/quic/quic_ack_notifier_test.cc
@@ -16,6 +16,8 @@ namespace {
class QuicAckNotifierTest : public ::testing::Test {
protected:
+ QuicAckNotifierTest() : zero_(QuicTime::Delta::Zero()) {}
+
virtual void SetUp() {
delegate_ = new MockAckNotifierDelegate;
notifier_.reset(new QuicAckNotifier(delegate_));
@@ -27,22 +29,23 @@ class QuicAckNotifierTest : public ::testing::Test {
MockAckNotifierDelegate* delegate_;
scoped_ptr<QuicAckNotifier> notifier_;
+ QuicTime::Delta zero_;
};
// Should trigger callback when we receive acks for all the registered seqnums.
TEST_F(QuicAckNotifierTest, TriggerCallback) {
- EXPECT_CALL(*delegate_, OnAckNotification(3, 123, 0, 0)).Times(1);
- EXPECT_FALSE(notifier_->OnAck(26));
- EXPECT_FALSE(notifier_->OnAck(99));
- EXPECT_TRUE(notifier_->OnAck(1234));
+ EXPECT_CALL(*delegate_, OnAckNotification(3, 123, 0, 0, zero_)).Times(1);
+ EXPECT_FALSE(notifier_->OnAck(26, zero_));
+ EXPECT_FALSE(notifier_->OnAck(99, zero_));
+ EXPECT_TRUE(notifier_->OnAck(1234, zero_));
}
// Should not trigger callback if we never provide all the seqnums.
TEST_F(QuicAckNotifierTest, DoesNotTrigger) {
// Should not trigger callback as not all packets have been seen.
- EXPECT_CALL(*delegate_, OnAckNotification(_, _, _, _)).Times(0);
- EXPECT_FALSE(notifier_->OnAck(26));
- EXPECT_FALSE(notifier_->OnAck(99));
+ EXPECT_CALL(*delegate_, OnAckNotification(_, _, _, _, _)).Times(0);
+ EXPECT_FALSE(notifier_->OnAck(26, zero_));
+ EXPECT_FALSE(notifier_->OnAck(99, zero_));
}
// Should trigger even after updating sequence numbers and receiving ACKs for
@@ -52,10 +55,24 @@ TEST_F(QuicAckNotifierTest, UpdateSeqNums) {
notifier_->UpdateSequenceNumber(99, 3000);
notifier_->UpdateSequenceNumber(1234, 3001);
- EXPECT_CALL(*delegate_, OnAckNotification(3, 123, 2, 20 + 3)).Times(1);
- EXPECT_FALSE(notifier_->OnAck(26)); // original
- EXPECT_FALSE(notifier_->OnAck(3000)); // updated
- EXPECT_TRUE(notifier_->OnAck(3001)); // updated
+ EXPECT_CALL(*delegate_, OnAckNotification(3, 123, 2, 20 + 3, _)).Times(1);
+ EXPECT_FALSE(notifier_->OnAck(26, zero_)); // original
+ EXPECT_FALSE(notifier_->OnAck(3000, zero_)); // updated
+ EXPECT_TRUE(notifier_->OnAck(3001, zero_)); // updated
+}
+
+// Make sure the delegate is called with the delta time from the last ACK.
+TEST_F(QuicAckNotifierTest, DeltaTime) {
+ const QuicTime::Delta first_delta = QuicTime::Delta::FromSeconds(5);
+ const QuicTime::Delta second_delta = QuicTime::Delta::FromSeconds(33);
+ const QuicTime::Delta third_delta = QuicTime::Delta::FromSeconds(10);
+
+ EXPECT_CALL(*delegate_,
+ OnAckNotification(3, 123, 0, 0, third_delta))
+ .Times(1);
+ EXPECT_FALSE(notifier_->OnAck(26, first_delta));
+ EXPECT_FALSE(notifier_->OnAck(99, second_delta));
+ EXPECT_TRUE(notifier_->OnAck(1234, third_delta));
}
} // namespace
« no previous file with comments | « net/quic/quic_ack_notifier_manager.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698