| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // 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 |
| 98 // dropped. | 98 // dropped. |
| 99 void set_max_bandwidth_and_buffer_size(QuicBandwidth fake_bandwidth, | 99 void set_max_bandwidth_and_buffer_size(QuicBandwidth fake_bandwidth, |
| 100 QuicByteCount buffer_size) { | 100 QuicByteCount buffer_size) { |
| 101 DCHECK(clock_); | 101 DCHECK(clock_); |
| 102 base::AutoLock locked(config_mutex_); | 102 base::AutoLock locked(config_mutex_); |
| 103 fake_bandwidth_ = fake_bandwidth; | 103 fake_bandwidth_ = fake_bandwidth; |
| 104 buffer_size_ = buffer_size; | 104 buffer_size_ = buffer_size; |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Useful for reproducing very flaky issues. |
| 107 void set_seed(uint64 seed) { | 108 void set_seed(uint64 seed) { |
| 108 simple_random_.set_seed(seed); | 109 simple_random_.set_seed(seed); |
| 109 } | 110 } |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 // Writes out the next packet to the contained writer and returns the time | 113 // Writes out the next packet to the contained writer and returns the time |
| 113 // for the next delayed packet to be written. | 114 // for the next delayed packet to be written. |
| 114 QuicTime ReleaseNextPacket(); | 115 QuicTime ReleaseNextPacket(); |
| 115 | 116 |
| 116 // A single packet which will be sent at the supplied send_time. | 117 // A single packet which will be sent at the supplied send_time. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 QuicByteCount buffer_size_; | 150 QuicByteCount buffer_size_; |
| 150 | 151 |
| 151 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); | 152 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); |
| 152 }; | 153 }; |
| 153 | 154 |
| 154 } // namespace test | 155 } // namespace test |
| 155 } // namespace tools | 156 } // namespace tools |
| 156 } // namespace net | 157 } // namespace net |
| 157 | 158 |
| 158 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 159 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
| OLD | NEW |