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/congestion_control/tcp_loss_algorithm.h" | 5 #include "net/quic/congestion_control/tcp_loss_algorithm.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 NULL, 0, new RetransmittableFrames()); | 26 NULL, 0, new RetransmittableFrames()); |
27 unacked_packets_.AddPacket(packet); | 27 unacked_packets_.AddPacket(packet); |
28 unacked_packets_.SetPending(sequence_number, QuicTime::Zero(), 1000); | 28 unacked_packets_.SetPending(sequence_number, QuicTime::Zero(), 1000); |
29 } | 29 } |
30 | 30 |
31 void VerifyLosses(QuicPacketSequenceNumber largest_observed, | 31 void VerifyLosses(QuicPacketSequenceNumber largest_observed, |
32 QuicPacketSequenceNumber* losses_expected, | 32 QuicPacketSequenceNumber* losses_expected, |
33 size_t num_losses) { | 33 size_t num_losses) { |
34 SequenceNumberSet lost_packets = | 34 SequenceNumberSet lost_packets = |
35 loss_algorithm_.DetectLostPackets( | 35 loss_algorithm_.DetectLostPackets( |
36 unacked_packets_, QuicTime::Zero(), largest_observed, srtt_); | 36 unacked_packets_, QuicTime::Zero(), largest_observed, srtt_, srtt_); |
37 EXPECT_EQ(num_losses, lost_packets.size()); | 37 EXPECT_EQ(num_losses, lost_packets.size()); |
38 for (size_t i = 0; i < num_losses; ++i) { | 38 for (size_t i = 0; i < num_losses; ++i) { |
39 EXPECT_TRUE(ContainsKey(lost_packets, losses_expected[i])); | 39 EXPECT_TRUE(ContainsKey(lost_packets, losses_expected[i])); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 QuicUnackedPacketMap unacked_packets_; | 43 QuicUnackedPacketMap unacked_packets_; |
44 TCPLossAlgorithm loss_algorithm_; | 44 TCPLossAlgorithm loss_algorithm_; |
45 QuicTime::Delta srtt_; | 45 QuicTime::Delta srtt_; |
46 }; | 46 }; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Early retransmit when the final packet gets acked and the first is nacked. | 138 // Early retransmit when the final packet gets acked and the first is nacked. |
139 unacked_packets_.SetNotPending(2); | 139 unacked_packets_.SetNotPending(2); |
140 unacked_packets_.NackPacket(1, 1); | 140 unacked_packets_.NackPacket(1, 1); |
141 unacked_packets_.NeuterPacket(1); | 141 unacked_packets_.NeuterPacket(1); |
142 VerifyLosses(2, NULL, 0); | 142 VerifyLosses(2, NULL, 0); |
143 } | 143 } |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 } // namespace test | 146 } // namespace test |
147 } // namespace net | 147 } // namespace net |
OLD | NEW |