OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_connection_peer.h" | 5 #include "net/quic/test_tools/quic_connection_peer.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/core/congestion_control/send_algorithm_interface.h" | 8 #include "net/quic/core/congestion_control/send_algorithm_interface.h" |
9 #include "net/quic/core/quic_multipath_sent_packet_manager.h" | 9 #include "net/quic/core/quic_multipath_sent_packet_manager.h" |
10 #include "net/quic/core/quic_packet_writer.h" | 10 #include "net/quic/core/quic_packet_writer.h" |
11 #include "net/quic/core/quic_received_packet_manager.h" | 11 #include "net/quic/core/quic_received_packet_manager.h" |
12 #include "net/quic/test_tools/quic_framer_peer.h" | 12 #include "net/quic/test_tools/quic_framer_peer.h" |
13 #include "net/quic/test_tools/quic_packet_generator_peer.h" | 13 #include "net/quic/test_tools/quic_packet_generator_peer.h" |
14 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 14 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 namespace test { | 17 namespace test { |
18 | 18 |
19 // static | 19 // static |
20 void QuicConnectionPeer::SendAck(QuicConnection* connection) { | 20 void QuicConnectionPeer::SendAck(QuicConnection* connection) { |
21 connection->SendAck(); | 21 connection->SendAck(); |
22 } | 22 } |
23 | 23 |
24 // static | 24 // static |
25 void QuicConnectionPeer::SetSendAlgorithm( | 25 void QuicConnectionPeer::SetSendAlgorithm( |
26 QuicConnection* connection, | 26 QuicConnection* connection, |
27 QuicPathId path_id, | 27 QuicPathId path_id, |
28 SendAlgorithmInterface* send_algorithm) { | 28 SendAlgorithmInterface* send_algorithm) { |
29 GetSentPacketManager(connection, path_id) | 29 GetSentPacketManager(connection, path_id)->SetSendAlgorithm(send_algorithm); |
30 ->send_algorithm_.reset(send_algorithm); | |
31 GetSentPacketManager(connection, path_id)->using_inline_pacing_ = false; | |
32 } | 30 } |
33 | 31 |
34 // static | 32 // static |
35 void QuicConnectionPeer::SetLossAlgorithm( | 33 void QuicConnectionPeer::SetLossAlgorithm( |
36 QuicConnection* connection, | 34 QuicConnection* connection, |
37 QuicPathId path_id, | 35 QuicPathId path_id, |
38 LossDetectionInterface* loss_algorithm) { | 36 LossDetectionInterface* loss_algorithm) { |
39 GetSentPacketManager(connection, path_id) | 37 GetSentPacketManager(connection, path_id)->loss_algorithm_ = loss_algorithm; |
40 ->loss_algorithm_.reset(loss_algorithm); | |
41 } | 38 } |
42 | 39 |
43 // static | 40 // static |
44 const QuicFrame QuicConnectionPeer::GetUpdatedAckFrame( | 41 const QuicFrame QuicConnectionPeer::GetUpdatedAckFrame( |
45 QuicConnection* connection) { | 42 QuicConnection* connection) { |
46 return connection->GetUpdatedAckFrame(); | 43 return connection->GetUpdatedAckFrame(); |
47 } | 44 } |
48 | 45 |
49 // static | 46 // static |
50 void QuicConnectionPeer::PopulateStopWaitingFrame( | 47 void QuicConnectionPeer::PopulateStopWaitingFrame( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return connection->multipath_enabled_; | 151 return connection->multipath_enabled_; |
155 } | 152 } |
156 | 153 |
157 // static | 154 // static |
158 void QuicConnectionPeer::SwapCrypters(QuicConnection* connection, | 155 void QuicConnectionPeer::SwapCrypters(QuicConnection* connection, |
159 QuicFramer* framer) { | 156 QuicFramer* framer) { |
160 QuicFramerPeer::SwapCrypters(framer, &connection->framer_); | 157 QuicFramerPeer::SwapCrypters(framer, &connection->framer_); |
161 } | 158 } |
162 | 159 |
163 // static | 160 // static |
| 161 void QuicConnectionPeer::SetCurrentPacket(QuicConnection* connection, |
| 162 base::StringPiece current_packet) { |
| 163 connection->current_packet_data_ = current_packet.data(); |
| 164 connection->last_size_ = current_packet.size(); |
| 165 } |
| 166 |
| 167 // static |
164 QuicConnectionHelperInterface* QuicConnectionPeer::GetHelper( | 168 QuicConnectionHelperInterface* QuicConnectionPeer::GetHelper( |
165 QuicConnection* connection) { | 169 QuicConnection* connection) { |
166 return connection->helper_; | 170 return connection->helper_; |
167 } | 171 } |
168 | 172 |
169 // static | 173 // static |
170 QuicAlarmFactory* QuicConnectionPeer::GetAlarmFactory( | 174 QuicAlarmFactory* QuicConnectionPeer::GetAlarmFactory( |
171 QuicConnection* connection) { | 175 QuicConnection* connection) { |
172 return connection->alarm_factory_; | 176 return connection->alarm_factory_; |
173 } | 177 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 bool QuicConnectionPeer::HasRetransmittableFrames( | 303 bool QuicConnectionPeer::HasRetransmittableFrames( |
300 QuicConnection* connection, | 304 QuicConnection* connection, |
301 QuicPathId path_id, | 305 QuicPathId path_id, |
302 QuicPacketNumber packet_number) { | 306 QuicPacketNumber packet_number) { |
303 return QuicSentPacketManagerPeer::HasRetransmittableFrames( | 307 return QuicSentPacketManagerPeer::HasRetransmittableFrames( |
304 GetSentPacketManager(connection, path_id), packet_number); | 308 GetSentPacketManager(connection, path_id), packet_number); |
305 } | 309 } |
306 | 310 |
307 } // namespace test | 311 } // namespace test |
308 } // namespace net | 312 } // namespace net |
OLD | NEW |