| 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_packet_writer.h" | 9 #include "net/quic/quic_packet_writer.h" |
| 10 #include "net/quic/quic_received_packet_manager.h" | 10 #include "net/quic/quic_received_packet_manager.h" |
| 11 #include "net/quic/test_tools/quic_framer_peer.h" | 11 #include "net/quic/test_tools/quic_framer_peer.h" |
| 12 #include "net/quic/test_tools/quic_packet_generator_peer.h" | 12 #include "net/quic/test_tools/quic_packet_generator_peer.h" |
| 13 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 13 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 namespace test { | 16 namespace test { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 void QuicConnectionPeer::SendAck(QuicConnection* connection) { | 19 void QuicConnectionPeer::SendAck(QuicConnection* connection) { |
| 20 connection->SendAck(); | 20 connection->SendAck(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 void QuicConnectionPeer::SetSendAlgorithm( | 24 void QuicConnectionPeer::SetSendAlgorithm( |
| 25 QuicConnection* connection, | 25 QuicConnection* connection, |
| 26 SendAlgorithmInterface* send_algorithm) { | 26 SendAlgorithmInterface* send_algorithm) { |
| 27 connection->sent_packet_manager_.send_algorithm_.reset(send_algorithm); | 27 // TODO(fayang): Remove this method when there is a MockSentPacketManager. |
| 28 static_cast<QuicSentPacketManager*>(connection->sent_packet_manager_.get()) |
| 29 ->send_algorithm_.reset(send_algorithm); |
| 28 } | 30 } |
| 29 | 31 |
| 30 // static | 32 // static |
| 31 const QuicFrame QuicConnectionPeer::GetUpdatedAckFrame( | 33 const QuicFrame QuicConnectionPeer::GetUpdatedAckFrame( |
| 32 QuicConnection* connection) { | 34 QuicConnection* connection) { |
| 33 return connection->GetUpdatedAckFrame(); | 35 return connection->GetUpdatedAckFrame(); |
| 34 } | 36 } |
| 35 | 37 |
| 36 // static | 38 // static |
| 37 void QuicConnectionPeer::PopulateStopWaitingFrame( | 39 void QuicConnectionPeer::PopulateStopWaitingFrame( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 55 | 57 |
| 56 // static | 58 // static |
| 57 QuicPacketGenerator* QuicConnectionPeer::GetPacketGenerator( | 59 QuicPacketGenerator* QuicConnectionPeer::GetPacketGenerator( |
| 58 QuicConnection* connection) { | 60 QuicConnection* connection) { |
| 59 return &connection->packet_generator_; | 61 return &connection->packet_generator_; |
| 60 } | 62 } |
| 61 | 63 |
| 62 // static | 64 // static |
| 63 QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( | 65 QuicSentPacketManager* QuicConnectionPeer::GetSentPacketManager( |
| 64 QuicConnection* connection) { | 66 QuicConnection* connection) { |
| 65 return &connection->sent_packet_manager_; | 67 // TODO(fayang): Remove this method when there is a MockSentPacketManager. |
| 68 return static_cast<QuicSentPacketManager*>( |
| 69 connection->sent_packet_manager_.get()); |
| 66 } | 70 } |
| 67 | 71 |
| 68 // static | 72 // static |
| 69 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( | 73 QuicTime::Delta QuicConnectionPeer::GetNetworkTimeout( |
| 70 QuicConnection* connection) { | 74 QuicConnection* connection) { |
| 71 return connection->idle_network_timeout_; | 75 return connection->idle_network_timeout_; |
| 72 } | 76 } |
| 73 | 77 |
| 74 // static | 78 // static |
| 75 QuicSentEntropyManager* QuicConnectionPeer::GetSentEntropyManager( | 79 QuicSentEntropyManager* QuicConnectionPeer::GetSentEntropyManager( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 273 } |
| 270 | 274 |
| 271 // static | 275 // static |
| 272 void QuicConnectionPeer::SetAckDecimationDelay(QuicConnection* connection, | 276 void QuicConnectionPeer::SetAckDecimationDelay(QuicConnection* connection, |
| 273 float ack_decimation_delay) { | 277 float ack_decimation_delay) { |
| 274 connection->ack_decimation_delay_ = ack_decimation_delay; | 278 connection->ack_decimation_delay_ = ack_decimation_delay; |
| 275 } | 279 } |
| 276 | 280 |
| 277 } // namespace test | 281 } // namespace test |
| 278 } // namespace net | 282 } // namespace net |
| OLD | NEW |