OLD | NEW |
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 20 matching lines...) Expand all Loading... |
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)); | 40 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength)); |
41 QuicFrames* frames = new QuicFrames(); | 41 SerializedPacket packet(kDefaultPathId, packet_number, |
| 42 PACKET_1BYTE_PACKET_NUMBER, packets_.back(), 0, |
| 43 false, false); |
42 QuicStreamFrame* frame = new QuicStreamFrame(); | 44 QuicStreamFrame* frame = new QuicStreamFrame(); |
43 frame->stream_id = stream_id; | 45 frame->stream_id = stream_id; |
44 frames->push_back(QuicFrame(frame)); | 46 packet.retransmittable_frames.push_back(QuicFrame(frame)); |
45 return SerializedPacket(kDefaultPathId, packet_number, | 47 return packet; |
46 PACKET_1BYTE_PACKET_NUMBER, packets_.back(), 0, | |
47 frames, false, false); | |
48 } | 48 } |
49 | 49 |
50 SerializedPacket CreateNonRetransmittablePacket( | 50 SerializedPacket CreateNonRetransmittablePacket( |
51 QuicPacketNumber packet_number) { | 51 QuicPacketNumber packet_number) { |
52 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength)); | 52 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength)); |
53 return SerializedPacket(kDefaultPathId, packet_number, | 53 return SerializedPacket(kDefaultPathId, packet_number, |
54 PACKET_1BYTE_PACKET_NUMBER, packets_.back(), 0, | 54 PACKET_1BYTE_PACKET_NUMBER, packets_.back(), 0, |
55 nullptr, false, false); | 55 false, false); |
56 } | 56 } |
57 | 57 |
58 void VerifyInFlightPackets(QuicPacketNumber* packets, size_t num_packets) { | 58 void VerifyInFlightPackets(QuicPacketNumber* packets, size_t num_packets) { |
59 unacked_packets_.RemoveObsoletePackets(); | 59 unacked_packets_.RemoveObsoletePackets(); |
60 if (num_packets == 0) { | 60 if (num_packets == 0) { |
61 EXPECT_FALSE(unacked_packets_.HasInFlightPackets()); | 61 EXPECT_FALSE(unacked_packets_.HasInFlightPackets()); |
62 EXPECT_FALSE(unacked_packets_.HasMultipleInFlightPackets()); | 62 EXPECT_FALSE(unacked_packets_.HasMultipleInFlightPackets()); |
63 return; | 63 return; |
64 } | 64 } |
65 if (num_packets == 1) { | 65 if (num_packets == 1) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 EXPECT_FALSE(unacked_packets_.IsUnacked(2)); | 413 EXPECT_FALSE(unacked_packets_.IsUnacked(2)); |
414 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); | 414 EXPECT_TRUE(unacked_packets_.IsUnacked(3)); |
415 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); | 415 EXPECT_FALSE(unacked_packets_.IsUnacked(4)); |
416 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); | 416 EXPECT_TRUE(unacked_packets_.IsUnacked(5)); |
417 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); | 417 EXPECT_EQ(5u, unacked_packets_.largest_sent_packet()); |
418 } | 418 } |
419 | 419 |
420 } // namespace | 420 } // namespace |
421 } // namespace test | 421 } // namespace test |
422 } // namespace net | 422 } // namespace net |
OLD | NEW |