OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/test_tools/quic_packet_creator_peer.h" | 5 #include "net/quic/test_tools/quic_packet_creator_peer.h" |
6 | 6 |
7 #include "net/quic/quic_packet_creator.h" | 7 #include "net/quic/quic_packet_creator.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 namespace test { | 10 namespace test { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 // static | 107 // static |
108 SerializedPacket QuicPacketCreatorPeer::SerializeFec(QuicPacketCreator* creator, | 108 SerializedPacket QuicPacketCreatorPeer::SerializeFec(QuicPacketCreator* creator, |
109 char* buffer, | 109 char* buffer, |
110 size_t buffer_len) { | 110 size_t buffer_len) { |
111 return creator->SerializeFec(buffer, buffer_len); | 111 return creator->SerializeFec(buffer, buffer_len); |
112 } | 112 } |
113 | 113 |
114 // static | 114 // static |
| 115 SerializedPacket QuicPacketCreatorPeer::SerializeAllFrames( |
| 116 QuicPacketCreator* creator, |
| 117 const QuicFrames& frames, |
| 118 char* buffer, |
| 119 size_t buffer_len) { |
| 120 DCHECK(creator->queued_frames_.empty()); |
| 121 DCHECK(!frames.empty()); |
| 122 for (const QuicFrame& frame : frames) { |
| 123 bool success = creator->AddFrame(frame, false); |
| 124 DCHECK(success); |
| 125 } |
| 126 SerializedPacket packet = creator->SerializePacket(buffer, buffer_len); |
| 127 DCHECK(packet.retransmittable_frames == nullptr); |
| 128 return packet; |
| 129 } |
| 130 |
| 131 // static |
115 void QuicPacketCreatorPeer::ResetFecGroup(QuicPacketCreator* creator) { | 132 void QuicPacketCreatorPeer::ResetFecGroup(QuicPacketCreator* creator) { |
116 creator->ResetFecGroup(); | 133 creator->ResetFecGroup(); |
117 } | 134 } |
118 | 135 |
119 // static | 136 // static |
120 QuicTime::Delta QuicPacketCreatorPeer::GetFecTimeout( | 137 QuicTime::Delta QuicPacketCreatorPeer::GetFecTimeout( |
121 QuicPacketCreator* creator) { | 138 QuicPacketCreator* creator) { |
122 return creator->fec_timeout_; | 139 return creator->fec_timeout_; |
123 } | 140 } |
124 | 141 |
125 // static | 142 // static |
126 float QuicPacketCreatorPeer::GetRttMultiplierForFecTimeout( | 143 float QuicPacketCreatorPeer::GetRttMultiplierForFecTimeout( |
127 QuicPacketCreator* creator) { | 144 QuicPacketCreator* creator) { |
128 return creator->rtt_multiplier_for_fec_timeout_; | 145 return creator->rtt_multiplier_for_fec_timeout_; |
129 } | 146 } |
130 | 147 |
131 // static | 148 // static |
132 EncryptionLevel QuicPacketCreatorPeer::GetEncryptionLevel( | 149 EncryptionLevel QuicPacketCreatorPeer::GetEncryptionLevel( |
133 QuicPacketCreator* creator) { | 150 QuicPacketCreator* creator) { |
134 return creator->encryption_level_; | 151 return creator->encryption_level_; |
135 } | 152 } |
136 | 153 |
137 // static | 154 // static |
138 QuicPathId QuicPacketCreatorPeer::GetCurrentPath(QuicPacketCreator* creator) { | 155 QuicPathId QuicPacketCreatorPeer::GetCurrentPath(QuicPacketCreator* creator) { |
139 return creator->current_path_; | 156 return creator->current_path_; |
140 } | 157 } |
141 | 158 |
142 } // namespace test | 159 } // namespace test |
143 } // namespace net | 160 } // namespace net |
OLD | NEW |