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

Side by Side Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 125183004: Fix a bug in QuicSentPacketManager::ClearPreviousRetransmissions where (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 8 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
9 #include "net/quic/test_tools/quic_test_utils.h" 9 #include "net/quic/test_tools/quic_test_utils.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 received_info.is_truncated = true; 381 received_info.is_truncated = true;
382 manager_.OnIncomingAck(received_info, QuicTime::Zero()); 382 manager_.OnIncomingAck(received_info, QuicTime::Zero());
383 383
384 // High water mark will be raised. 384 // High water mark will be raised.
385 QuicPacketSequenceNumber unacked[] = { 2, 3, 4 }; 385 QuicPacketSequenceNumber unacked[] = { 2, 3, 4 };
386 VerifyUnackedPackets(unacked, arraysize(unacked)); 386 VerifyUnackedPackets(unacked, arraysize(unacked));
387 QuicPacketSequenceNumber retransmittable[] = { 4 }; 387 QuicPacketSequenceNumber retransmittable[] = { 4 };
388 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable)); 388 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable));
389 } 389 }
390 390
391 TEST_F(QuicSentPacketManagerTest, AckPreviousTransmissionThenTruncatedAck) {
392 SerializedPacket serialized_packet(CreateDataPacket(1));
393
394 manager_.OnSerializedPacket(serialized_packet);
395 RetransmitPacket(1, 2);
396 RetransmitPacket(2, 3);
397 RetransmitPacket(3, 4);
398 manager_.OnSerializedPacket(CreateDataPacket(5));
399 manager_.OnSerializedPacket(CreateDataPacket(6));
400 manager_.OnSerializedPacket(CreateDataPacket(7));
401 manager_.OnSerializedPacket(CreateDataPacket(8));
402 manager_.OnSerializedPacket(CreateDataPacket(9));
403
404 // Ack previous transmission
405 {
406 ReceivedPacketInfo received_info;
407 received_info.largest_observed = 2;
408 received_info.missing_packets.insert(1);
409 manager_.OnIncomingAck(received_info, QuicTime::Zero());
410 EXPECT_TRUE(manager_.IsUnacked(4));
411 }
412
413 // Truncated ack with 4 NACKs
414 {
415 ReceivedPacketInfo received_info;
416 received_info.largest_observed = 6;
417 received_info.missing_packets.insert(3);
418 received_info.missing_packets.insert(4);
419 received_info.missing_packets.insert(5);
420 received_info.missing_packets.insert(6);
421 received_info.is_truncated = true;
422 manager_.OnIncomingAck(received_info, QuicTime::Zero());
423 }
424
425 // High water mark will be raised.
426 QuicPacketSequenceNumber unacked[] = { 5, 6, 7, 8, 9 };
427 VerifyUnackedPackets(unacked, arraysize(unacked));
428 QuicPacketSequenceNumber retransmittable[] = { 5, 6, 7, 8, 9 };
429 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable));
430 }
431
391 TEST_F(QuicSentPacketManagerTest, SendDropAckRetransmitManyPackets) { 432 TEST_F(QuicSentPacketManagerTest, SendDropAckRetransmitManyPackets) {
392 manager_.OnSerializedPacket(CreateDataPacket(1)); 433 manager_.OnSerializedPacket(CreateDataPacket(1));
393 manager_.OnSerializedPacket(CreateDataPacket(2)); 434 manager_.OnSerializedPacket(CreateDataPacket(2));
394 manager_.OnSerializedPacket(CreateDataPacket(3)); 435 manager_.OnSerializedPacket(CreateDataPacket(3));
395 436
396 { 437 {
397 // Ack packets 1 and 3. 438 // Ack packets 1 and 3.
398 ReceivedPacketInfo received_info; 439 ReceivedPacketInfo received_info;
399 received_info.largest_observed = 3; 440 received_info.largest_observed = 3;
400 received_info.missing_packets.insert(2); 441 received_info.missing_packets.insert(2);
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 delay = delay.Add(delay); 1165 delay = delay.Add(delay);
1125 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true)); 1166 EXPECT_CALL(*send_algorithm_, OnRetransmissionTimeout(true));
1126 manager_.OnRetransmissionTimeout(); 1167 manager_.OnRetransmissionTimeout();
1127 RetransmitNextPacket(i + 2); 1168 RetransmitNextPacket(i + 2);
1128 } 1169 }
1129 } 1170 }
1130 1171
1131 } // namespace 1172 } // namespace
1132 } // namespace test 1173 } // namespace test
1133 } // namespace net 1174 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698