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 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
6 #define NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 // The percent of time a packet is simulated as being reordered. | 80 // The percent of time a packet is simulated as being reordered. |
81 void set_fake_reorder_percentage(int32 fake_packet_reorder_percentage) { | 81 void set_fake_reorder_percentage(int32 fake_packet_reorder_percentage) { |
82 DCHECK(clock_); | 82 DCHECK(clock_); |
83 base::AutoLock locked(config_mutex_); | 83 base::AutoLock locked(config_mutex_); |
84 DCHECK(!fake_packet_delay_.IsZero()); | 84 DCHECK(!fake_packet_delay_.IsZero()); |
85 fake_packet_reorder_percentage_ = fake_packet_reorder_percentage; | 85 fake_packet_reorder_percentage_ = fake_packet_reorder_percentage; |
86 } | 86 } |
87 | 87 |
88 // The percent of time WritePacket will block and set WriteResult's status | 88 // The delay before writing this packet. |
89 // to WRITE_STATUS_BLOCKED. | |
90 void set_fake_packet_delay(QuicTime::Delta fake_packet_delay) { | 89 void set_fake_packet_delay(QuicTime::Delta fake_packet_delay) { |
91 DCHECK(clock_); | 90 DCHECK(clock_); |
92 base::AutoLock locked(config_mutex_); | 91 base::AutoLock locked(config_mutex_); |
93 fake_packet_delay_ = fake_packet_delay; | 92 fake_packet_delay_ = fake_packet_delay; |
94 } | 93 } |
95 | 94 |
96 // The maximum bandwidth and buffer size of the connection. When these are | 95 // The maximum bandwidth and buffer size of the connection. When these are |
97 // set, packets will be delayed until a connection with that bandwidth would | 96 // set, packets will be delayed until a connection with that bandwidth would |
98 // transmit it. Once the |buffer_size| is reached, all new packets are | 97 // transmit it. Once the |buffer_size| is reached, all new packets are |
99 // dropped. | 98 // dropped. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 QuicByteCount buffer_size_; | 149 QuicByteCount buffer_size_; |
151 | 150 |
152 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); | 151 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); |
153 }; | 152 }; |
154 | 153 |
155 } // namespace test | 154 } // namespace test |
156 } // namespace tools | 155 } // namespace tools |
157 } // namespace net | 156 } // namespace net |
158 | 157 |
159 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 158 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
OLD | NEW |