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

Unified Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 181723003: Start using the loss timeout in QuicSentPacketManager and add a mock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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_sent_packet_manager.cc ('k') | net/quic/test_tools/quic_sent_packet_manager_peer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_sent_packet_manager_test.cc
diff --git a/net/quic/quic_sent_packet_manager_test.cc b/net/quic/quic_sent_packet_manager_test.cc
index 3ab3e3964e847a161170b2efc4eeb4da2ee1278b..066d52504e2257e733ae1745fa4f64f1bebab331 100644
--- a/net/quic/quic_sent_packet_manager_test.cc
+++ b/net/quic/quic_sent_packet_manager_test.cc
@@ -1120,6 +1120,38 @@ TEST_F(QuicSentPacketManagerTest, GetTransmissionDelay) {
}
}
+TEST_F(QuicSentPacketManagerTest, GetLossDelay) {
+ MockLossAlgorithm* loss_algorithm = new MockLossAlgorithm();
+ QuicSentPacketManagerPeer::SetLossAlgorithm(&manager_, loss_algorithm);
+
+ EXPECT_CALL(*loss_algorithm, GetLossTimeout())
+ .WillRepeatedly(Return(QuicTime::Zero()));
+ SendDataPacket(1);
+ SendDataPacket(2);
+
+ // Handle an ack which causes the loss algorithm to be evaluated and
+ // set the loss timeout.
+ EXPECT_CALL(*send_algorithm_, UpdateRtt(_));
+ EXPECT_CALL(*send_algorithm_, OnPacketAcked(2, _));
+ EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _))
+ .WillOnce(Return(SequenceNumberSet()));
+ ReceivedPacketInfo received_info;
+ received_info.largest_observed = 2;
+ received_info.missing_packets.insert(1);
+ manager_.OnIncomingAck(received_info, clock_.Now());
+
+ QuicTime timeout(clock_.Now().Add(QuicTime::Delta::FromMilliseconds(10)));
+ EXPECT_CALL(*loss_algorithm, GetLossTimeout())
+ .WillRepeatedly(Return(timeout));
+ EXPECT_EQ(timeout, manager_.GetRetransmissionTime());
+
+ // Fire the retransmission timeout and ensure the loss detection algorithm
+ // is invoked.
+ EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _))
+ .WillOnce(Return(SequenceNumberSet()));
+ manager_.OnRetransmissionTimeout();
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/test_tools/quic_sent_packet_manager_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698