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

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

Issue 968513002: Land Recent QUIC Changes until 2/21/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed const from members of TransmissionInfo struct. Created 5 years, 9 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
« no previous file with comments | « net/quic/quic_unacked_packet_map.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_unacked_packet_map.h" 5 #include "net/quic/quic_unacked_packet_map.h"
6 6
7 #include "net/quic/test_tools/quic_test_utils.h" 7 #include "net/quic/test_tools/quic_test_utils.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using std::min; 10 using std::min;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 true); 341 true);
342 342
343 QuicPacketSequenceNumber unacked4[] = { 4, 6 }; 343 QuicPacketSequenceNumber unacked4[] = { 4, 6 };
344 VerifyUnackedPackets(unacked4, arraysize(unacked4)); 344 VerifyUnackedPackets(unacked4, arraysize(unacked4));
345 QuicPacketSequenceNumber pending4[] = { 6 }; 345 QuicPacketSequenceNumber pending4[] = { 6 };
346 VerifyInFlightPackets(pending4, arraysize(pending4)); 346 VerifyInFlightPackets(pending4, arraysize(pending4));
347 QuicPacketSequenceNumber retransmittable4[] = { 6 }; 347 QuicPacketSequenceNumber retransmittable4[] = { 6 };
348 VerifyRetransmittablePackets(retransmittable4, arraysize(retransmittable4)); 348 VerifyRetransmittablePackets(retransmittable4, arraysize(retransmittable4));
349 } 349 }
350 350
351 TEST_F(QuicUnackedPacketMapTest, RestoreInflight) {
352 // Simulate a retransmittable packet being sent, retransmitted, and the first
353 // transmission being acked.
354 unacked_packets_.AddSentPacket(CreateRetransmittablePacket(1), 0,
355 NOT_RETRANSMISSION, now_, kDefaultLength,
356 true);
357 unacked_packets_.RemoveFromInFlight(1);
358 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(2), 1,
359 RTO_RETRANSMISSION, now_, kDefaultLength,
360 true);
361
362 QuicPacketSequenceNumber unacked[] = { 1, 2 };
363 VerifyUnackedPackets(unacked, arraysize(unacked));
364 QuicPacketSequenceNumber retransmittable[] = { 2 };
365 VerifyInFlightPackets(retransmittable, arraysize(retransmittable));
366 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable));
367 EXPECT_EQ(kDefaultLength, unacked_packets_.bytes_in_flight());
368
369 // Simulate an F-RTO, and restore 1 to flight.
370 unacked_packets_.RestoreInFlight(1);
371 VerifyUnackedPackets(unacked, arraysize(unacked));
372 VerifyInFlightPackets(unacked, arraysize(unacked));
373 VerifyRetransmittablePackets(retransmittable, arraysize(retransmittable));
374 EXPECT_EQ(2 * kDefaultLength, unacked_packets_.bytes_in_flight());
375 }
376
377 TEST_F(QuicUnackedPacketMapTest, SendWithGap) { 351 TEST_F(QuicUnackedPacketMapTest, SendWithGap) {
378 // Simulate a retransmittable packet being sent, retransmitted, and the first 352 // Simulate a retransmittable packet being sent, retransmitted, and the first
379 // transmission being acked. 353 // transmission being acked.
380 unacked_packets_.AddSentPacket(CreateRetransmittablePacket(1), 0, 354 unacked_packets_.AddSentPacket(CreateRetransmittablePacket(1), 0,
381 NOT_RETRANSMISSION, now_, kDefaultLength, 355 NOT_RETRANSMISSION, now_, kDefaultLength,
382 true); 356 true);
383 unacked_packets_.AddSentPacket(CreateRetransmittablePacket(3), 0, 357 unacked_packets_.AddSentPacket(CreateRetransmittablePacket(3), 0,
384 NOT_RETRANSMISSION, now_, kDefaultLength, 358 NOT_RETRANSMISSION, now_, kDefaultLength,
385 true); 359 true);
386 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(5), 3, 360 unacked_packets_.AddSentPacket(CreateNonRetransmittablePacket(5), 3,
387 LOSS_RETRANSMISSION, now_, kDefaultLength, 361 LOSS_RETRANSMISSION, now_, kDefaultLength,
388 true); 362 true);
389 363
390 EXPECT_EQ(1u, unacked_packets_.GetLeastUnacked()); 364 EXPECT_EQ(1u, unacked_packets_.GetLeastUnacked());
391 EXPECT_TRUE(unacked_packets_.IsUnacked(1)); 365 EXPECT_TRUE(unacked_packets_.IsUnacked(1));
392 EXPECT_FALSE(unacked_packets_.IsUnacked(2)); 366 EXPECT_FALSE(unacked_packets_.IsUnacked(2));
393 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); 367 EXPECT_TRUE(unacked_packets_.IsUnacked(3));
394 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); 368 EXPECT_FALSE(unacked_packets_.IsUnacked(4));
395 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); 369 EXPECT_TRUE(unacked_packets_.IsUnacked(5));
396 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); 370 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet());
397 } 371 }
398 372
399 373
400 } // namespace 374 } // namespace
401 } // namespace test 375 } // namespace test
402 } // namespace net 376 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_unacked_packet_map.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698