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/congestion_control/send_algorithm_interface.h" | 8 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 9 #include "net/quic/quic_multipath_sent_packet_manager.h" |
9 #include "net/quic/quic_packet_writer.h" | 10 #include "net/quic/quic_packet_writer.h" |
10 #include "net/quic/quic_received_packet_manager.h" | 11 #include "net/quic/quic_received_packet_manager.h" |
11 #include "net/quic/test_tools/quic_framer_peer.h" | 12 #include "net/quic/test_tools/quic_framer_peer.h" |
12 #include "net/quic/test_tools/quic_packet_generator_peer.h" | 13 #include "net/quic/test_tools/quic_packet_generator_peer.h" |
13 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 14 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 namespace test { | 17 namespace test { |
17 | 18 |
18 // static | 19 // static |
19 void QuicConnectionPeer::SendAck(QuicConnection* connection) { | 20 void QuicConnectionPeer::SendAck(QuicConnection* connection) { |
20 connection->SendAck(); | 21 connection->SendAck(); |
21 } | 22 } |
22 | 23 |
23 // static | 24 // static |
24 void QuicConnectionPeer::SetSendAlgorithm( | 25 void QuicConnectionPeer::SetSendAlgorithm( |
25 QuicConnection* connection, | 26 QuicConnection* connection, |
| 27 QuicPathId path_id, |
26 SendAlgorithmInterface* send_algorithm) { | 28 SendAlgorithmInterface* send_algorithm) { |
27 // TODO(fayang): Remove this method when there is a MockSentPacketManager. | 29 GetSentPacketManager(connection, path_id) |
28 static_cast<QuicSentPacketManager*>(connection->sent_packet_manager_.get()) | |
29 ->send_algorithm_.reset(send_algorithm); | 30 ->send_algorithm_.reset(send_algorithm); |
30 } | 31 } |
31 | 32 |
32 // static | 33 // static |
| 34 void QuicConnectionPeer::SetLossAlgorithm( |
| 35 QuicConnection* connection, |
| 36 QuicPathId path_id, |
| 37 LossDetectionInterface* loss_algorithm) { |
| 38 GetSentPacketManager(connection, path_id) |
| 39 ->loss_algorithm_.reset(loss_algorithm); |
| 40 } |
| 41 |
| 42 // static |
33 const QuicFrame QuicConnectionPeer::GetUpdatedAckFrame( | 43 const QuicFrame QuicConnectionPeer::GetUpdatedAckFrame( |
34 QuicConnection* connection) { | 44 QuicConnection* connection) { |
35 return connection->GetUpdatedAckFrame(); | 45 return connection->GetUpdatedAckFrame(); |
36 } | 46 } |
37 | 47 |
38 // static | 48 // static |
39 void QuicConnectionPeer::PopulateStopWaitingFrame( | 49 void QuicConnectionPeer::PopulateStopWaitingFrame( |
40 QuicConnection* connection, | 50 QuicConnection* connection, |
41 QuicStopWaitingFrame* stop_waiting) { | 51 QuicStopWaitingFrame* stop_waiting) { |
42 connection->PopulateStopWaitingFrame(stop_waiting); | 52 connection->PopulateStopWaitingFrame(stop_waiting); |
(...skipping 13 matching lines...) Expand all Loading... |
56 } | 66 } |
57 | 67 |
58 // static | 68 // static |
59 QuicPacketGenerator* QuicConnectionPeer::GetPacketGenerator( | 69 QuicPacketGenerator* QuicConnectionPeer::GetPacketGenerator( |
60 QuicConnection* connection) { | 70 QuicConnection* connection) { |
61 return &connection->packet_generator_; | 71 return &connection->packet_generator_; |
62 } | 72 } |
63 | 73 |
64 // static | 74 // static |
65 QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( | 75 QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( |
66 QuicConnection* connection) { | 76 QuicConnection* connection, |
67 // TODO(fayang): Remove this method when there is a MockSentPacketManager. | 77 QuicPathId path_id) { |
| 78 if (FLAGS_quic_enable_multipath) { |
| 79 return static_cast<QuicSentPacketManager*>( |
| 80 static_cast<QuicMultipathSentPacketManager*>( |
| 81 connection->sent_packet_manager_.get()) |
| 82 ->MaybeGetSentPacketManagerForPath(path_id)); |
| 83 } |
68 return static_cast<QuicSentPacketManager*>( | 84 return static_cast<QuicSentPacketManager*>( |
69 connection->sent_packet_manager_.get()); | 85 connection->sent_packet_manager_.get()); |
70 } | 86 } |
71 | 87 |
72 // static | 88 // static |
73 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( | 89 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( |
74 QuicConnection* connection) { | 90 QuicConnection* connection) { |
75 return connection->idle_network_timeout_; | 91 return connection->idle_network_timeout_; |
76 } | 92 } |
77 | 93 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 289 } |
274 | 290 |
275 // static | 291 // static |
276 void QuicConnectionPeer::SetAckDecimationDelay(QuicConnection* connection, | 292 void QuicConnectionPeer::SetAckDecimationDelay(QuicConnection* connection, |
277 float ack_decimation_delay) { | 293 float ack_decimation_delay) { |
278 connection->ack_decimation_delay_ = ack_decimation_delay; | 294 connection->ack_decimation_delay_ = ack_decimation_delay; |
279 } | 295 } |
280 | 296 |
281 } // namespace test | 297 } // namespace test |
282 } // namespace net | 298 } // namespace net |
OLD | NEW |