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

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

Issue 422123005: Fix a bug in QuicUnackedPacketMap where an in flight packet could be (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Inline_ReceivedPacketInfo_71763611
Patch Set: Created 6 years, 4 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') | 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 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 namespace net { 10 namespace net {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 VerifyUnackedPackets(unacked, arraysize(unacked2)); 170 VerifyUnackedPackets(unacked, arraysize(unacked2));
171 VerifyInFlightPackets(unacked, arraysize(unacked2)); 171 VerifyInFlightPackets(unacked, arraysize(unacked2));
172 VerifyRetransmittablePackets(NULL, 0); 172 VerifyRetransmittablePackets(NULL, 0);
173 173
174 unacked_packets_.RemoveFromInFlight(1); 174 unacked_packets_.RemoveFromInFlight(1);
175 VerifyUnackedPackets(NULL, 0); 175 VerifyUnackedPackets(NULL, 0);
176 VerifyInFlightPackets(NULL, 0); 176 VerifyInFlightPackets(NULL, 0);
177 VerifyRetransmittablePackets(NULL, 0); 177 VerifyRetransmittablePackets(NULL, 0);
178 } 178 }
179 179
180 TEST_F(QuicUnackedPacketMapTest, RetransmitTwice) { 180 TEST_F(QuicUnackedPacketMapTest, RetransmitThreeTimes) {
181 // Simulate a retransmittable packet being sent and retransmitted twice. 181 // Simulate a retransmittable packet being sent and retransmitted twice.
182 unacked_packets_.AddPacket(CreateRetransmittablePacket(1)); 182 unacked_packets_.AddPacket(CreateRetransmittablePacket(1));
183 unacked_packets_.SetSent(1, now_, kDefaultLength, true); 183 unacked_packets_.SetSent(1, now_, kDefaultLength, true);
184 unacked_packets_.AddPacket(CreateRetransmittablePacket(2)); 184 unacked_packets_.AddPacket(CreateRetransmittablePacket(2));
185 unacked_packets_.SetSent(2, now_, kDefaultLength, true); 185 unacked_packets_.SetSent(2, now_, kDefaultLength, true);
186 186
187 QuicPacketSequenceNumber unacked[] = { 1, 2 }; 187 QuicPacketSequenceNumber unacked[] = { 1, 2 };
188 VerifyUnackedPackets(unacked, arraysize(unacked)); 188 VerifyUnackedPackets(unacked, arraysize(unacked));
189 VerifyInFlightPackets(unacked, arraysize(unacked)); 189 VerifyInFlightPackets(unacked, arraysize(unacked));
190 QuicPacketSequenceNumber retransmittable[] = { 1, 2 }; 190 QuicPacketSequenceNumber retransmittable[] = { 1, 2 };
(...skipping 13 matching lines...) Expand all
204 VerifyUnackedPackets(unacked2, arraysize(unacked2)); 204 VerifyUnackedPackets(unacked2, arraysize(unacked2));
205 QuicPacketSequenceNumber pending2[] = { 3, 4, }; 205 QuicPacketSequenceNumber pending2[] = { 3, 4, };
206 VerifyInFlightPackets(pending2, arraysize(pending2)); 206 VerifyInFlightPackets(pending2, arraysize(pending2));
207 QuicPacketSequenceNumber retransmittable2[] = { 3, 4 }; 207 QuicPacketSequenceNumber retransmittable2[] = { 3, 4 };
208 VerifyRetransmittablePackets(retransmittable2, arraysize(retransmittable2)); 208 VerifyRetransmittablePackets(retransmittable2, arraysize(retransmittable2));
209 209
210 // Early retransmit 3 (formerly 1) as 5, and remove 1 from unacked. 210 // Early retransmit 3 (formerly 1) as 5, and remove 1 from unacked.
211 unacked_packets_.IncreaseLargestObserved(4); 211 unacked_packets_.IncreaseLargestObserved(4);
212 unacked_packets_.RemoveFromInFlight(4); 212 unacked_packets_.RemoveFromInFlight(4);
213 unacked_packets_.RemoveRetransmittability(4); 213 unacked_packets_.RemoveRetransmittability(4);
214 unacked_packets_.RemoveFromInFlight(3);
215 unacked_packets_.OnRetransmittedPacket(3, 5, LOSS_RETRANSMISSION); 214 unacked_packets_.OnRetransmittedPacket(3, 5, LOSS_RETRANSMISSION);
216 unacked_packets_.SetSent(5, now_, kDefaultLength, true); 215 unacked_packets_.SetSent(5, now_, kDefaultLength, true);
216 unacked_packets_.AddPacket(CreateRetransmittablePacket(6));
217 unacked_packets_.SetSent(6, now_, kDefaultLength, true);
217 218
218 QuicPacketSequenceNumber unacked3[] = { 3, 5 }; 219 QuicPacketSequenceNumber unacked3[] = { 3, 5, 6 };
219 VerifyUnackedPackets(unacked3, arraysize(unacked3)); 220 VerifyUnackedPackets(unacked3, arraysize(unacked3));
220 QuicPacketSequenceNumber pending3[] = { 5 }; 221 QuicPacketSequenceNumber pending3[] = { 3, 5, 6 };
221 VerifyInFlightPackets(pending3, arraysize(pending3)); 222 VerifyInFlightPackets(pending3, arraysize(pending3));
222 QuicPacketSequenceNumber retransmittable3[] = { 5 }; 223 QuicPacketSequenceNumber retransmittable3[] = { 5, 6 };
223 VerifyRetransmittablePackets(retransmittable3, arraysize(retransmittable3)); 224 VerifyRetransmittablePackets(retransmittable3, arraysize(retransmittable3));
225
226 // Early retransmit 5 as 7 and ensure in flight packet 3 is not removed.
227 unacked_packets_.IncreaseLargestObserved(6);
228 unacked_packets_.RemoveFromInFlight(6);
229 unacked_packets_.RemoveRetransmittability(6);
230 unacked_packets_.OnRetransmittedPacket(5, 7, LOSS_RETRANSMISSION);
231 unacked_packets_.SetSent(7, now_, kDefaultLength, true);
232
233 QuicPacketSequenceNumber unacked4[] = { 3, 5, 7 };
234 VerifyUnackedPackets(unacked4, arraysize(unacked4));
235 QuicPacketSequenceNumber pending4[] = { 3, 5, 7 };
236 VerifyInFlightPackets(pending4, arraysize(pending4));
237 QuicPacketSequenceNumber retransmittable4[] = { 7 };
238 VerifyRetransmittablePackets(retransmittable4, arraysize(retransmittable4));
224 } 239 }
225 240
226 } // namespace 241 } // namespace
227 } // namespace test 242 } // namespace test
228 } // namespace net 243 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_unacked_packet_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698