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

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

Issue 1660593004: Landing Recent QUIC changes until 01/28/2016 18:41 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0202
Patch Set: 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_sent_packet_manager.cc ('k') | net/quic/quic_session.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_sent_packet_manager.h" 5 #include "net/quic/quic_sent_packet_manager.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/test_tools/quic_config_peer.h" 9 #include "net/quic/test_tools/quic_config_peer.h"
10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 new_packet_number)); 188 new_packet_number));
189 } 189 }
190 190
191 SerializedPacket CreateDataPacket(QuicPacketNumber packet_number) { 191 SerializedPacket CreateDataPacket(QuicPacketNumber packet_number) {
192 return CreatePacket(packet_number, true); 192 return CreatePacket(packet_number, true);
193 } 193 }
194 194
195 SerializedPacket CreatePacket(QuicPacketNumber packet_number, 195 SerializedPacket CreatePacket(QuicPacketNumber packet_number,
196 bool retransmittable) { 196 bool retransmittable) {
197 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength)); 197 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
198 QuicFrames* frames = nullptr; 198 SerializedPacket packet(kDefaultPathId, packet_number,
199 PACKET_6BYTE_PACKET_NUMBER, packets_.back(), 0u,
200 false, false);
199 if (retransmittable) { 201 if (retransmittable) {
200 frames = new QuicFrames(); 202 packet.retransmittable_frames.push_back(
201 frames->push_back(
202 QuicFrame(new QuicStreamFrame(kStreamId, false, 0, StringPiece()))); 203 QuicFrame(new QuicStreamFrame(kStreamId, false, 0, StringPiece())));
203 } 204 }
204 return SerializedPacket(kDefaultPathId, packet_number, 205 return packet;
205 PACKET_6BYTE_PACKET_NUMBER, packets_.back(), 0u,
206 frames, false, false);
207 } 206 }
208 207
209 SerializedPacket CreateFecPacket(QuicPacketNumber packet_number) { 208 SerializedPacket CreateFecPacket(QuicPacketNumber packet_number) {
210 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength)); 209 packets_.push_back(new QuicEncryptedPacket(nullptr, kDefaultLength));
211 SerializedPacket serialized(kDefaultPathId, packet_number, 210 SerializedPacket serialized(kDefaultPathId, packet_number,
212 PACKET_6BYTE_PACKET_NUMBER, packets_.back(), 0u, 211 PACKET_6BYTE_PACKET_NUMBER, packets_.back(), 0u,
213 nullptr, false, false); 212 false, false);
214 serialized.is_fec_packet = true; 213 serialized.is_fec_packet = true;
215 return serialized; 214 return serialized;
216 } 215 }
217 216
218 void SendDataPacket(QuicPacketNumber packet_number) { 217 void SendDataPacket(QuicPacketNumber packet_number) {
219 EXPECT_CALL(*send_algorithm_, 218 EXPECT_CALL(*send_algorithm_,
220 OnPacketSent(_, BytesInFlight(), packet_number, _, _)) 219 OnPacketSent(_, BytesInFlight(), packet_number, _, _))
221 .Times(1) 220 .Times(1)
222 .WillOnce(Return(true)); 221 .WillOnce(Return(true));
223 SerializedPacket packet(CreateDataPacket(packet_number)); 222 SerializedPacket packet(CreateDataPacket(packet_number));
224 manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(), 223 manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(),
225 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); 224 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
226 } 225 }
227 226
228 void SendCryptoPacket(QuicPacketNumber packet_number) { 227 void SendCryptoPacket(QuicPacketNumber packet_number) {
229 EXPECT_CALL(*send_algorithm_, 228 EXPECT_CALL(*send_algorithm_,
230 OnPacketSent(_, BytesInFlight(), packet_number, kDefaultLength, 229 OnPacketSent(_, BytesInFlight(), packet_number, kDefaultLength,
231 HAS_RETRANSMITTABLE_DATA)) 230 HAS_RETRANSMITTABLE_DATA))
232 .Times(1) 231 .Times(1)
233 .WillOnce(Return(true)); 232 .WillOnce(Return(true));
234 SerializedPacket packet(CreateDataPacket(packet_number)); 233 SerializedPacket packet(CreateDataPacket(packet_number));
235 packet.retransmittable_frames->push_back( 234 packet.retransmittable_frames.push_back(
236 QuicFrame(new QuicStreamFrame(1, false, 0, StringPiece()))); 235 QuicFrame(new QuicStreamFrame(1, false, 0, StringPiece())));
237 packet.has_crypto_handshake = IS_HANDSHAKE; 236 packet.has_crypto_handshake = IS_HANDSHAKE;
238 manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(), 237 manager_.OnPacketSent(&packet, 0, clock_.Now(), packet.packet->length(),
239 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); 238 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA);
240 } 239 }
241 240
242 void SendFecPacket(QuicPacketNumber packet_number) { 241 void SendFecPacket(QuicPacketNumber packet_number) {
243 EXPECT_CALL(*send_algorithm_, 242 EXPECT_CALL(*send_algorithm_,
244 OnPacketSent(_, BytesInFlight(), packet_number, kDefaultLength, 243 OnPacketSent(_, BytesInFlight(), packet_number, kDefaultLength,
245 HAS_RETRANSMITTABLE_DATA)) 244 HAS_RETRANSMITTABLE_DATA))
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 1695
1697 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false)); 1696 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_, false));
1698 manager_.ResumeConnectionState(cached_network_params, false); 1697 manager_.ResumeConnectionState(cached_network_params, false);
1699 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1698 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1700 static_cast<uint64_t>(manager_.GetRttStats()->initial_rtt_us())); 1699 static_cast<uint64_t>(manager_.GetRttStats()->initial_rtt_us()));
1701 } 1700 }
1702 1701
1703 } // namespace 1702 } // namespace
1704 } // namespace test 1703 } // namespace test
1705 } // namespace net 1704 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698