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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...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; |
33 virtual void OnCanWrite() = 0; | 34 virtual void OnCanWrite() = 0; |
34 }; | 35 }; |
35 | 36 |
36 PacketDroppingTestWriter(); | 37 PacketDroppingTestWriter(); |
37 | 38 |
38 virtual ~PacketDroppingTestWriter(); | 39 virtual ~PacketDroppingTestWriter(); |
39 | 40 |
40 // Must be called before blocking, reordering or delaying (loss is OK). May be | 41 // Must be called before blocking, reordering or delaying (loss is OK). May be |
41 // called after connecting if the helper is not available before. | 42 // called after connecting if the helper is not available before. |
42 // |on_can_write| will be triggered when fake-unblocking; ownership will be | 43 // |on_can_write| will be triggered when fake-unblocking; ownership will be |
(...skipping 106 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 |