| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 bool IsWriteBlocked() const override; | 57 bool IsWriteBlocked() const override; |
| 58 | 58 |
| 59 void SetWritable() override; | 59 void SetWritable() override; |
| 60 | 60 |
| 61 // Writes out any packet which should have been sent by now | 61 // Writes out any packet which should have been sent by now |
| 62 // to the contained writer and returns the time | 62 // to the contained writer and returns the time |
| 63 // for the next delayed packet to be written. | 63 // for the next delayed packet to be written. |
| 64 QuicTime ReleaseOldPackets(); | 64 QuicTime ReleaseOldPackets(); |
| 65 | 65 |
| 66 // Sets |delay_alarm_| to fire at |new_deadline|. |
| 67 void SetDelayAlarm(QuicTime new_deadline); |
| 68 |
| 66 void OnCanWrite(); | 69 void OnCanWrite(); |
| 67 | 70 |
| 68 // The percent of time a packet is simulated as being lost. | 71 // The percent of time a packet is simulated as being lost. |
| 69 void set_fake_packet_loss_percentage(int32_t fake_packet_loss_percentage) { | 72 void set_fake_packet_loss_percentage(int32_t fake_packet_loss_percentage) { |
| 70 base::AutoLock locked(config_mutex_); | 73 base::AutoLock locked(config_mutex_); |
| 71 fake_packet_loss_percentage_ = fake_packet_loss_percentage; | 74 fake_packet_loss_percentage_ = fake_packet_loss_percentage; |
| 72 } | 75 } |
| 73 | 76 |
| 74 // Simulate dropping the first n packets unconditionally. | 77 // Simulate dropping the first n packets unconditionally. |
| 75 // Subsequent packets will be lost at fake_packet_loss_percentage_ if set. | 78 // Subsequent packets will be lost at fake_packet_loss_percentage_ if set. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 QuicBandwidth fake_bandwidth_; | 171 QuicBandwidth fake_bandwidth_; |
| 169 QuicByteCount buffer_size_; | 172 QuicByteCount buffer_size_; |
| 170 | 173 |
| 171 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); | 174 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); |
| 172 }; | 175 }; |
| 173 | 176 |
| 174 } // namespace test | 177 } // namespace test |
| 175 } // namespace net | 178 } // namespace net |
| 176 | 179 |
| 177 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 180 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
| OLD | NEW |