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

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

Issue 1667583004: Landing Recent QUIC changes until 01/31/2016 05:22 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0203
Patch Set: Rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_stream_factory_test.cc ('k') | net/quic/quic_utils.h » ('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 "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "net/quic/quic_utils.h" 9 #include "net/quic/quic_utils.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 19 matching lines...) Expand all
30 ~QuicUnackedPacketMapTest() override { STLDeleteElements(&packets_); } 30 ~QuicUnackedPacketMapTest() override { STLDeleteElements(&packets_); }
31 31
32 SerializedPacket CreateRetransmittablePacket(QuicPacketNumber packet_number) { 32 SerializedPacket CreateRetransmittablePacket(QuicPacketNumber packet_number) {
33 return CreateRetransmittablePacketForStream(packet_number, 33 return CreateRetransmittablePacketForStream(packet_number,
34 kHeadersStreamId); 34 kHeadersStreamId);
35 } 35 }
36 36
37 SerializedPacket CreateRetransmittablePacketForStream( 37 SerializedPacket CreateRetransmittablePacketForStream(
38 QuicPacketNumber packet_number, 38 QuicPacketNumber packet_number,
39 QuicStreamId stream_id) { 39 QuicStreamId stream_id) {
40 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
41 SerializedPacket packet(kDefaultPathId, packet_number, 40 SerializedPacket packet(kDefaultPathId, packet_number,
42 PACKET_1BYTE_PACKET_NUMBER, packets_.back(), 0, 41 PACKET_1BYTE_PACKET_NUMBER, nullptr, kDefaultLength,
43 false, false); 42 0, false, false);
44 QuicStreamFrame* frame = new QuicStreamFrame(); 43 QuicStreamFrame* frame = new QuicStreamFrame();
45 frame->stream_id = stream_id; 44 frame->stream_id = stream_id;
46 packet.retransmittable_frames.push_back(QuicFrame(frame)); 45 packet.retransmittable_frames.push_back(QuicFrame(frame));
47 return packet; 46 return packet;
48 } 47 }
49 48
50 SerializedPacket CreateNonRetransmittablePacket( 49 SerializedPacket CreateNonRetransmittablePacket(
51 QuicPacketNumber packet_number) { 50 QuicPacketNumber packet_number) {
52 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
53 return SerializedPacket(kDefaultPathId, packet_number, 51 return SerializedPacket(kDefaultPathId, packet_number,
54 PACKET_1BYTE_PACKET_NUMBER, packets_.back(), 0, 52 PACKET_1BYTE_PACKET_NUMBER, nullptr, kDefaultLength,
55 false, false); 53 0, false, false);
56 } 54 }
57 55
58 void VerifyInFlightPackets(QuicPacketNumber* packets, size_t num_packets) { 56 void VerifyInFlightPackets(QuicPacketNumber* packets, size_t num_packets) {
59 unacked_packets_.RemoveObsoletePackets(); 57 unacked_packets_.RemoveObsoletePackets();
60 if (num_packets == 0) { 58 if (num_packets == 0) {
61 EXPECT_FALSE(unacked_packets_.HasInFlightPackets()); 59 EXPECT_FALSE(unacked_packets_.HasInFlightPackets());
62 EXPECT_FALSE(unacked_packets_.HasMultipleInFlightPackets()); 60 EXPECT_FALSE(unacked_packets_.HasMultipleInFlightPackets());
63 return; 61 return;
64 } 62 }
65 if (num_packets == 1) { 63 if (num_packets == 1) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 EXPECT_FALSE(unacked_packets_.IsUnacked(2)); 411 EXPECT_FALSE(unacked_packets_.IsUnacked(2));
414 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); 412 EXPECT_TRUE(unacked_packets_.IsUnacked(3));
415 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); 413 EXPECT_FALSE(unacked_packets_.IsUnacked(4));
416 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); 414 EXPECT_TRUE(unacked_packets_.IsUnacked(5));
417 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); 415 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet());
418 } 416 }
419 417
420 } // namespace 418 } // namespace
421 } // namespace test 419 } // namespace test
422 } // namespace net 420 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory_test.cc ('k') | net/quic/quic_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698