| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "net/quic/quic_alarm.h" | 14 #include "net/quic/quic_alarm.h" |
| 15 #include "net/quic/quic_blocked_writer_interface.h" | |
| 16 #include "net/tools/quic/quic_epoll_clock.h" | 15 #include "net/tools/quic/quic_epoll_clock.h" |
| 17 #include "net/tools/quic/quic_packet_writer_wrapper.h" | 16 #include "net/tools/quic/quic_packet_writer_wrapper.h" |
| 18 #include "net/tools/quic/test_tools/quic_test_client.h" | 17 #include "net/tools/quic/test_tools/quic_test_client.h" |
| 19 #include "net/tools/quic/test_tools/quic_test_utils.h" | 18 #include "net/tools/quic/test_tools/quic_test_utils.h" |
| 20 | 19 |
| 21 namespace net { | 20 namespace net { |
| 22 namespace tools { | 21 namespace tools { |
| 23 namespace test { | 22 namespace test { |
| 24 | 23 |
| 25 // Simulates a connection that drops packets a configured percentage of the time | 24 // Simulates a connection that drops packets a configured percentage of the time |
| (...skipping 15 matching lines...) Expand all Loading... |
| 41 // called after connecting if the helper is not available before. | 40 // called after connecting if the helper is not available before. |
| 42 // |on_can_write| will be triggered when fake-unblocking; ownership will be | 41 // |on_can_write| will be triggered when fake-unblocking; ownership will be |
| 43 // assumed. | 42 // assumed. |
| 44 void Initialize(QuicEpollConnectionHelper* helper, Delegate* on_can_write); | 43 void Initialize(QuicEpollConnectionHelper* helper, Delegate* on_can_write); |
| 45 | 44 |
| 46 // QuicPacketWriter methods: | 45 // QuicPacketWriter methods: |
| 47 virtual WriteResult WritePacket( | 46 virtual WriteResult WritePacket( |
| 48 const char* buffer, | 47 const char* buffer, |
| 49 size_t buf_len, | 48 size_t buf_len, |
| 50 const IPAddressNumber& self_address, | 49 const IPAddressNumber& self_address, |
| 51 const IPEndPoint& peer_address, | 50 const IPEndPoint& peer_address) OVERRIDE; |
| 52 QuicBlockedWriterInterface* blocked_writer) OVERRIDE; | |
| 53 | 51 |
| 54 virtual bool IsWriteBlocked() const OVERRIDE; | 52 virtual bool IsWriteBlocked() const OVERRIDE; |
| 55 | 53 |
| 56 virtual void SetWritable() OVERRIDE; | 54 virtual void SetWritable() OVERRIDE; |
| 57 | 55 |
| 58 // Writes out any packet which should have been sent by now | 56 // Writes out any packet which should have been sent by now |
| 59 // to the contained writer and returns the time | 57 // to the contained writer and returns the time |
| 60 // for the next delayed packet to be written. | 58 // for the next delayed packet to be written. |
| 61 QuicTime ReleaseOldPackets(); | 59 QuicTime ReleaseOldPackets(); |
| 62 | 60 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 QuicByteCount buffer_size_; | 148 QuicByteCount buffer_size_; |
| 151 | 149 |
| 152 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); | 150 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); |
| 153 }; | 151 }; |
| 154 | 152 |
| 155 } // namespace test | 153 } // namespace test |
| 156 } // namespace tools | 154 } // namespace tools |
| 157 } // namespace net | 155 } // namespace net |
| 158 | 156 |
| 159 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 157 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
| OLD | NEW |