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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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_server_session.cc » ('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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate()) 58 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate())
59 .Times(AnyNumber()); 59 .Times(AnyNumber());
60 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) 60 EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
61 .Times(AnyNumber()) 61 .Times(AnyNumber())
62 .WillRepeatedly(Return(QuicBandwidth::Zero())); 62 .WillRepeatedly(Return(QuicBandwidth::Zero()));
63 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber()); 63 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber());
64 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); 64 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber());
65 } 65 }
66 66
67 virtual ~QuicSentPacketManagerTest() override { 67 ~QuicSentPacketManagerTest() override { STLDeleteElements(&packets_); }
68 STLDeleteElements(&packets_);
69 }
70 68
71 QuicByteCount BytesInFlight() { 69 QuicByteCount BytesInFlight() {
72 return QuicSentPacketManagerPeer::GetBytesInFlight(&manager_); 70 return QuicSentPacketManagerPeer::GetBytesInFlight(&manager_);
73 } 71 }
74 void VerifyUnackedPackets(QuicPacketSequenceNumber* packets, 72 void VerifyUnackedPackets(QuicPacketSequenceNumber* packets,
75 size_t num_packets) { 73 size_t num_packets) {
76 if (num_packets == 0) { 74 if (num_packets == 0) {
77 EXPECT_FALSE(manager_.HasUnackedPackets()); 75 EXPECT_FALSE(manager_.HasUnackedPackets());
78 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetNumRetransmittablePackets( 76 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetNumRetransmittablePackets(
79 &manager_)); 77 &manager_));
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 new QuicStreamFrame(1, false, 0, IOVector())); 207 new QuicStreamFrame(1, false, 0, IOVector()));
210 packet.retransmittable_frames->set_encryption_level(ENCRYPTION_NONE); 208 packet.retransmittable_frames->set_encryption_level(ENCRYPTION_NONE);
211 manager_.OnPacketSent(&packet, 0, clock_.Now(), 209 manager_.OnPacketSent(&packet, 0, clock_.Now(),
212 packet.packet->length(), NOT_RETRANSMISSION, 210 packet.packet->length(), NOT_RETRANSMISSION,
213 HAS_RETRANSMITTABLE_DATA); 211 HAS_RETRANSMITTABLE_DATA);
214 } 212 }
215 213
216 void SendFecPacket(QuicPacketSequenceNumber sequence_number) { 214 void SendFecPacket(QuicPacketSequenceNumber sequence_number) {
217 EXPECT_CALL(*send_algorithm_, 215 EXPECT_CALL(*send_algorithm_,
218 OnPacketSent(_, BytesInFlight(), sequence_number, 216 OnPacketSent(_, BytesInFlight(), sequence_number,
219 kDefaultLength, NO_RETRANSMITTABLE_DATA)) 217 kDefaultLength, HAS_RETRANSMITTABLE_DATA))
220 .Times(1).WillOnce(Return(true)); 218 .Times(1).WillOnce(Return(true));
221 SerializedPacket packet(CreateFecPacket(sequence_number)); 219 SerializedPacket packet(CreateFecPacket(sequence_number));
222 manager_.OnPacketSent(&packet, 0, clock_.Now(), 220 manager_.OnPacketSent(&packet, 0, clock_.Now(),
223 packet.packet->length(), NOT_RETRANSMISSION, 221 packet.packet->length(), NOT_RETRANSMISSION,
224 NO_RETRANSMITTABLE_DATA); 222 NO_RETRANSMITTABLE_DATA);
225 } 223 }
226 224
227 void SendAckPacket(QuicPacketSequenceNumber sequence_number) { 225 void SendAckPacket(QuicPacketSequenceNumber sequence_number) {
228 EXPECT_CALL(*send_algorithm_, 226 EXPECT_CALL(*send_algorithm_,
229 OnPacketSent(_, BytesInFlight(), sequence_number, 227 OnPacketSent(_, BytesInFlight(), sequence_number,
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1447 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1450 manager_.SetFromConfig(config); 1448 manager_.SetFromConfig(config);
1451 1449
1452 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1450 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1453 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); 1451 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us());
1454 } 1452 }
1455 1453
1456 } // namespace 1454 } // namespace
1457 } // namespace test 1455 } // namespace test
1458 } // namespace net 1456 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698