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 12 matching lines...) Expand all Loading... |
23 namespace test { | 23 namespace test { |
24 | 24 |
25 // Simulates a connection that drops packets a configured percentage of the time | 25 // Simulates a connection that drops packets a configured percentage of the time |
26 // and has a blocked socket a configured percentage of the time. Also provides | 26 // and has a blocked socket a configured percentage of the time. Also provides |
27 // the options to delay packets and reorder packets if delay is enabled. | 27 // the options to delay packets and reorder packets if delay is enabled. |
28 class PacketDroppingTestWriter : public QuicPacketWriterWrapper { | 28 class PacketDroppingTestWriter : public QuicPacketWriterWrapper { |
29 public: | 29 public: |
30 class Delegate { | 30 class Delegate { |
31 public: | 31 public: |
32 virtual ~Delegate() {} | 32 virtual ~Delegate() {} |
33 virtual void OnPacketSent(WriteResult result) = 0; | |
34 virtual void OnCanWrite() = 0; | 33 virtual void OnCanWrite() = 0; |
35 }; | 34 }; |
36 | 35 |
37 PacketDroppingTestWriter(); | 36 PacketDroppingTestWriter(); |
38 | 37 |
39 ~PacketDroppingTestWriter() override; | 38 ~PacketDroppingTestWriter() override; |
40 | 39 |
41 // Must be called before blocking, reordering or delaying (loss is OK). May be | 40 // Must be called before blocking, reordering or delaying (loss is OK). May be |
42 // called after connecting if the helper is not available before. | 41 // called after connecting if the helper is not available before. |
43 // |on_can_write| will be triggered when fake-unblocking; ownership will be | 42 // |on_can_write| will be triggered when fake-unblocking; ownership will be |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 QuicByteCount buffer_size_; | 158 QuicByteCount buffer_size_; |
160 | 159 |
161 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); | 160 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); |
162 }; | 161 }; |
163 | 162 |
164 } // namespace test | 163 } // namespace test |
165 } // namespace tools | 164 } // namespace tools |
166 } // namespace net | 165 } // namespace net |
167 | 166 |
168 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 167 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
OLD | NEW |