Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: net/tools/quic/test_tools/packet_dropping_test_writer.h

Issue 131743009: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use size_t instead of int to fix win_x64 compile error Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/logging.h" 11 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
13 #include "net/quic/quic_alarm.h" 14 #include "net/quic/quic_alarm.h"
14 #include "net/quic/quic_blocked_writer_interface.h" 15 #include "net/quic/quic_blocked_writer_interface.h"
15 #include "net/quic/quic_packet_writer.h"
16 #include "net/quic/test_tools/quic_test_writer.h"
17 #include "net/tools/quic/quic_epoll_clock.h" 16 #include "net/tools/quic/quic_epoll_clock.h"
17 #include "net/tools/quic/quic_packet_writer_wrapper.h"
18 #include "net/tools/quic/test_tools/quic_test_client.h" 18 #include "net/tools/quic/test_tools/quic_test_client.h"
19 #include "net/tools/quic/test_tools/quic_test_utils.h" 19 #include "net/tools/quic/test_tools/quic_test_utils.h"
20 20
21 namespace net { 21 namespace net {
22 namespace tools { 22 namespace tools {
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 net::test::QuicTestWriter { 28 class PacketDroppingTestWriter : public QuicPacketWriterWrapper {
29 public: 29 public:
30 PacketDroppingTestWriter(); 30 PacketDroppingTestWriter();
31 31
32 virtual ~PacketDroppingTestWriter(); 32 virtual ~PacketDroppingTestWriter();
33 33
34 void SetConnectionHelper(QuicEpollConnectionHelper* helper); 34 void SetConnectionHelper(QuicEpollConnectionHelper* helper);
35 35
36 // QuicPacketWriter methods: 36 // QuicPacketWriter methods:
37 virtual WriteResult WritePacket( 37 virtual WriteResult WritePacket(
38 const char* buffer, size_t buf_len, 38 const char* buffer,
39 size_t buf_len,
39 const IPAddressNumber& self_address, 40 const IPAddressNumber& self_address,
40 const IPEndPoint& peer_address, 41 const IPEndPoint& peer_address,
41 QuicBlockedWriterInterface* blocked_writer) OVERRIDE; 42 QuicBlockedWriterInterface* blocked_writer) OVERRIDE;
42 43
43 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE;
44
45 // Writes out any packet which should have been sent by now 44 // Writes out any packet which should have been sent by now
46 // to the contained writer and returns the time 45 // to the contained writer and returns the time
47 // for the next delayed packet to be written. 46 // for the next delayed packet to be written.
48 QuicTime ReleaseOldPackets(); 47 QuicTime ReleaseOldPackets();
49 48
50 QuicBlockedWriterInterface* blocked_writer() { return blocked_writer_; } 49 QuicBlockedWriterInterface* blocked_writer() { return blocked_writer_; }
51 50
52 // The percent of time a packet is simulated as being lost. 51 // The percent of time a packet is simulated as being lost.
53 void set_fake_packet_loss_percentage(int32 fake_packet_loss_percentage) { 52 void set_fake_packet_loss_percentage(int32 fake_packet_loss_percentage) {
54 base::AutoLock locked(config_mutex_); 53 base::AutoLock locked(config_mutex_);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 QuicByteCount buffer_size_; 136 QuicByteCount buffer_size_;
138 137
139 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); 138 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter);
140 }; 139 };
141 140
142 } // namespace test 141 } // namespace test
143 } // namespace tools 142 } // namespace tools
144 } // namespace net 143 } // namespace net
145 144
146 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ 145 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/mock_quic_dispatcher.cc ('k') | net/tools/quic/test_tools/packet_dropping_test_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698