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_connection_test.cc

Issue 515003003: Remove PacketType from QUIC because the QUEUED type is not used and the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dont_send_SCUP_message_74132773
Patch Set: Created 6 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
« no previous file with comments | « net/quic/quic_connection.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection_test.cc
diff --git a/net/quic/quic_connection_test.cc b/net/quic/quic_connection_test.cc
index b002230e5c81d4f4a3eb0550f258512807a7665b..986cf45ada1f5609321354cc1a5e4c1ca65ae181 100644
--- a/net/quic/quic_connection_test.cc
+++ b/net/quic/quic_connection_test.cc
@@ -2742,162 +2742,21 @@ TEST_P(QuicConnectionTest, TimeoutAfterSend) {
TEST_P(QuicConnectionTest, SendScheduler) {
// Test that if we send a packet without delay, it is not queued.
QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
connection_.SendPacket(
ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
EXPECT_EQ(0u, connection_.NumQueuedPackets());
}
-TEST_P(QuicConnectionTest, SendSchedulerDelay) {
- // Test that if we send a packet with a delay, it ends up queued.
- QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(1)));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 1, _, _)).Times(0);
- connection_.SendPacket(
- ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-}
-
TEST_P(QuicConnectionTest, SendSchedulerEAGAIN) {
QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
BlockOnNextWrite();
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::Zero()));
EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 1, _, _)).Times(0);
connection_.SendPacket(
ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
EXPECT_EQ(1u, connection_.NumQueuedPackets());
}
-TEST_P(QuicConnectionTest, SendSchedulerDelayThenSend) {
- // Test that if we send a packet with a delay, it ends up queued.
- QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(1)));
- connection_.SendPacket(
- ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-
- // Advance the clock to fire the alarm, and configure the scheduler
- // to permit the packet to be sent.
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::Zero()));
- clock_.AdvanceTime(QuicTime::Delta::FromMicroseconds(1));
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- connection_.GetSendAlarm()->Fire();
- EXPECT_EQ(0u, connection_.NumQueuedPackets());
-}
-
-TEST_P(QuicConnectionTest, SendSchedulerDelayThenRetransmit) {
- CongestionUnblockWrites();
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, 1, _, _));
- connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL);
- EXPECT_EQ(0u, connection_.NumQueuedPackets());
- // Advance the time for retransmission of lost packet.
- clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(501));
- // Test that if we send a retransmit with a delay, it ends up queued in the
- // sent packet manager, but not yet serialized.
- EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
- CongestionBlockWrites();
- connection_.GetRetransmissionAlarm()->Fire();
- EXPECT_EQ(0u, connection_.NumQueuedPackets());
-
- // Advance the clock to fire the alarm, and configure the scheduler
- // to permit the packet to be sent.
- CongestionUnblockWrites();
-
- // Ensure the scheduler is notified this is a retransmit.
- EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _));
- clock_.AdvanceTime(QuicTime::Delta::FromMicroseconds(1));
- connection_.GetSendAlarm()->Fire();
- EXPECT_EQ(0u, connection_.NumQueuedPackets());
-}
-
-TEST_P(QuicConnectionTest, SendSchedulerDelayAndQueue) {
- QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(1)));
- connection_.SendPacket(
- ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-
- // Attempt to send another packet and make sure that it gets queued.
- packet = ConstructDataPacket(2, 0, !kEntropyFlag);
- connection_.SendPacket(
- ENCRYPTION_NONE, 2, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(2u, connection_.NumQueuedPackets());
-}
-
-TEST_P(QuicConnectionTest, SendSchedulerDelayThenAckAndSend) {
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(10)));
- connection_.SendPacket(
- ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-
- // Now send non-retransmitting information, that we're not going to
- // retransmit 3. The far end should stop waiting for it.
- QuicAckFrame frame = InitAckFrame(0);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillRepeatedly(
- testing::Return(QuicTime::Delta::Zero()));
- EXPECT_CALL(*send_algorithm_,
- OnPacketSent(_, _, _, _, _));
- ProcessAckPacket(&frame);
-
- EXPECT_EQ(0u, connection_.NumQueuedPackets());
- // Ensure alarm is not set
- EXPECT_FALSE(connection_.GetSendAlarm()->IsSet());
-}
-
-TEST_P(QuicConnectionTest, SendSchedulerDelayThenAckAndHold) {
- EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
- QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(10)));
- connection_.SendPacket(
- ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-
- // Now send non-retransmitting information, that we're not going to
- // retransmit 3. The far end should stop waiting for it.
- QuicAckFrame frame = InitAckFrame(0);
- EXPECT_CALL(*send_algorithm_,
- TimeUntilSend(_, _, _)).WillOnce(
- testing::Return(QuicTime::Delta::FromMicroseconds(1)));
- ProcessAckPacket(&frame);
-
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-}
-
-TEST_P(QuicConnectionTest, SendSchedulerDelayThenOnCanWrite) {
- // TODO(ianswett): This test is unrealistic, because we would not serialize
- // new data if the send algorithm said not to.
- QuicPacket* packet = ConstructDataPacket(1, 0, !kEntropyFlag);
- CongestionBlockWrites();
- connection_.SendPacket(
- ENCRYPTION_NONE, 1, packet, kTestEntropyHash, HAS_RETRANSMITTABLE_DATA);
- EXPECT_EQ(1u, connection_.NumQueuedPackets());
-
- // OnCanWrite should send the packet, because it won't consult the send
- // algorithm for queued packets.
- connection_.OnCanWrite();
- EXPECT_EQ(0u, connection_.NumQueuedPackets());
-}
-
TEST_P(QuicConnectionTest, TestQueueLimitsOnSendStreamData) {
// All packets carry version info till version is negotiated.
size_t payload_length;
« no previous file with comments | « net/quic/quic_connection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698