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 3 // found in the LICENSE file. 4 5 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 6 7 #include "base/stl_util.h" 8 #include "net/quic/congestion_control/send_algorithm_interface.h" 9 #include "net/quic/quic_protocol.h" 10 #include "net/quic/quic_sent_packet_manager.h" 11 12 namespace net { 13 namespace test { 14 15 // static 16 void QuicSentPacketManagerPeer::SetSendAlgorithm( 17 QuicSentPacketManager* sent_packet_manager, 18 SendAlgorithmInterface* send_algorithm) { 19 sent_packet_manager->send_algorithm_.reset(send_algorithm); 20 } 21 22 // static 23 size_t QuicSentPacketManagerPeer::GetNackCount( 24 const QuicSentPacketManager* sent_packet_manager, 25 QuicPacketSequenceNumber sequence_number) { 26 return sent_packet_manager->packet_history_map_.find( 27 sequence_number)->second->nack_count(); 28 } 29 30 // static 31 QuicTime QuicSentPacketManagerPeer::GetSentTime( 32 const QuicSentPacketManager* sent_packet_manager, 33 QuicPacketSequenceNumber sequence_number) { 34 DCHECK(ContainsKey(sent_packet_manager->unacked_packets_, sequence_number)); 35 36 return sent_packet_manager->unacked_packets_ 37 .find(sequence_number)->second.sent_time; 38 } 39 40 // static 41 QuicTime::Delta QuicSentPacketManagerPeer::rtt( 42 QuicSentPacketManager* sent_packet_manager) { 43 return sent_packet_manager->rtt_sample_; 44 } 45 46 // static 47 bool QuicSentPacketManagerPeer::IsRetransmission( 48 QuicSentPacketManager* sent_packet_manager, 49 QuicPacketSequenceNumber sequence_number) { 50 DCHECK(sent_packet_manager->HasRetransmittableFrames(sequence_number)); 51 return sent_packet_manager->HasRetransmittableFrames(sequence_number) && 52 sent_packet_manager-> 53 unacked_packets_[sequence_number].previous_transmissions != NULL; 54 } 55 56 // static 57 void QuicSentPacketManagerPeer::MarkForRetransmission( 58 QuicSentPacketManager* sent_packet_manager, 59 QuicPacketSequenceNumber sequence_number, 60 TransmissionType transmission_type) { 61 sent_packet_manager->MarkForRetransmission(sequence_number, 62 transmission_type); 63 } 64 65 } // namespace test 66 } // namespace net 67