OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_sent_packet_manager_peer.h" | 5 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/congestion_control/loss_detection_interface.h" | 8 #include "net/quic/congestion_control/loss_detection_interface.h" |
9 #include "net/quic/congestion_control/send_algorithm_interface.h" | 9 #include "net/quic/congestion_control/send_algorithm_interface.h" |
10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
11 #include "net/quic/quic_sent_packet_manager.h" | 11 #include "net/quic/quic_sent_packet_manager.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 namespace test { | 14 namespace test { |
15 | 15 |
16 // static | 16 // static |
17 size_t QuicSentPacketManagerPeer::GetMaxTailLossProbes( | 17 size_t QuicSentPacketManagerPeer::GetMaxTailLossProbes( |
18 QuicSentPacketManager* sent_packet_manager) { | 18 QuicSentPacketManager* sent_packet_manager) { |
19 return sent_packet_manager->max_tail_loss_probes_; | 19 return sent_packet_manager->max_tail_loss_probes_; |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 void QuicSentPacketManagerPeer::SetMaxTailLossProbes( | 23 void QuicSentPacketManagerPeer::SetMaxTailLossProbes( |
24 QuicSentPacketManager* sent_packet_manager, size_t max_tail_loss_probes) { | 24 QuicSentPacketManager* sent_packet_manager, size_t max_tail_loss_probes) { |
25 sent_packet_manager->max_tail_loss_probes_ = max_tail_loss_probes; | 25 sent_packet_manager->max_tail_loss_probes_ = max_tail_loss_probes; |
26 } | 26 } |
27 | 27 |
28 // static | 28 // static |
29 void QuicSentPacketManagerPeer::SetSendAlgorithm( | 29 QuicByteCount QuicSentPacketManagerPeer::GetReceiveWindow( |
30 QuicSentPacketManager* sent_packet_manager, | 30 QuicSentPacketManager* sent_packet_manager) { |
31 SendAlgorithmInterface* send_algorithm) { | 31 return sent_packet_manager->receive_buffer_bytes_; |
32 sent_packet_manager->send_algorithm_.reset(send_algorithm); | |
33 } | 32 } |
34 | 33 |
35 // static | 34 // static |
36 void QuicSentPacketManagerPeer::SetIsServer( | 35 void QuicSentPacketManagerPeer::SetIsServer( |
37 QuicSentPacketManager* sent_packet_manager, | 36 QuicSentPacketManager* sent_packet_manager, |
38 bool is_server) { | 37 bool is_server) { |
39 sent_packet_manager->is_server_ = is_server; | 38 sent_packet_manager->is_server_ = is_server; |
40 } | 39 } |
41 | 40 |
42 // static | 41 // static |
| 42 const SendAlgorithmInterface* |
| 43 QuicSentPacketManagerPeer::GetSendAlgorithm( |
| 44 const QuicSentPacketManager& sent_packet_manager) { |
| 45 return sent_packet_manager.send_algorithm_.get(); |
| 46 } |
| 47 |
| 48 // static |
| 49 void QuicSentPacketManagerPeer::SetSendAlgorithm( |
| 50 QuicSentPacketManager* sent_packet_manager, |
| 51 SendAlgorithmInterface* send_algorithm) { |
| 52 sent_packet_manager->send_algorithm_.reset(send_algorithm); |
| 53 } |
| 54 |
| 55 // static |
43 const LossDetectionInterface* QuicSentPacketManagerPeer::GetLossAlgorithm( | 56 const LossDetectionInterface* QuicSentPacketManagerPeer::GetLossAlgorithm( |
44 QuicSentPacketManager* sent_packet_manager) { | 57 QuicSentPacketManager* sent_packet_manager) { |
45 return sent_packet_manager->loss_algorithm_.get(); | 58 return sent_packet_manager->loss_algorithm_.get(); |
46 } | 59 } |
47 | 60 |
48 // static | 61 // static |
49 const SendAlgorithmInterface* | |
50 QuicSentPacketManagerPeer::GetCongestionControlAlgorithm( | |
51 const QuicSentPacketManager& sent_packet_manager) { | |
52 return sent_packet_manager.send_algorithm_.get(); | |
53 } | |
54 | |
55 // static | |
56 void QuicSentPacketManagerPeer::SetLossAlgorithm( | 62 void QuicSentPacketManagerPeer::SetLossAlgorithm( |
57 QuicSentPacketManager* sent_packet_manager, | 63 QuicSentPacketManager* sent_packet_manager, |
58 LossDetectionInterface* loss_detector) { | 64 LossDetectionInterface* loss_detector) { |
59 sent_packet_manager->loss_algorithm_.reset(loss_detector); | 65 sent_packet_manager->loss_algorithm_.reset(loss_detector); |
60 } | 66 } |
61 | 67 |
62 // static | 68 // static |
63 RttStats* QuicSentPacketManagerPeer::GetRttStats( | 69 RttStats* QuicSentPacketManagerPeer::GetRttStats( |
64 QuicSentPacketManager* sent_packet_manager) { | 70 QuicSentPacketManager* sent_packet_manager) { |
65 return &sent_packet_manager->rtt_stats_; | 71 return &sent_packet_manager->rtt_stats_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 160 } |
155 | 161 |
156 // static | 162 // static |
157 QuicSustainedBandwidthRecorder& QuicSentPacketManagerPeer::GetBandwidthRecorder( | 163 QuicSustainedBandwidthRecorder& QuicSentPacketManagerPeer::GetBandwidthRecorder( |
158 QuicSentPacketManager* sent_packet_manager) { | 164 QuicSentPacketManager* sent_packet_manager) { |
159 return sent_packet_manager->sustained_bandwidth_recorder_; | 165 return sent_packet_manager->sustained_bandwidth_recorder_; |
160 } | 166 } |
161 | 167 |
162 } // namespace test | 168 } // namespace test |
163 } // namespace net | 169 } // namespace net |
OLD | NEW |