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

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

Issue 2403233003: Automated rollback of internal change 130388085. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « net/tools/quic/quic_server.cc ('k') | net/tools/quic/test_tools/packet_dropping_test_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 QuicByteCount buffer_size) { 114 QuicByteCount buffer_size) {
115 DCHECK(clock_); 115 DCHECK(clock_);
116 base::AutoLock locked(config_mutex_); 116 base::AutoLock locked(config_mutex_);
117 fake_bandwidth_ = fake_bandwidth; 117 fake_bandwidth_ = fake_bandwidth;
118 buffer_size_ = buffer_size; 118 buffer_size_ = buffer_size;
119 } 119 }
120 120
121 // Useful for reproducing very flaky issues. 121 // Useful for reproducing very flaky issues.
122 void set_seed(uint64_t seed) { simple_random_.set_seed(seed); } 122 void set_seed(uint64_t seed) { simple_random_.set_seed(seed); }
123 123
124 // Sets the maximum allowed packet size to be sent. Packets larger than
125 // |packet_size| will cause the write to check-fail.
126 void set_max_allowed_packet_size(QuicByteCount packet_size) {
127 max_allowed_packet_size_ = packet_size;
128 }
129
130 private: 124 private:
131 // Writes out the next packet to the contained writer and returns the time 125 // Writes out the next packet to the contained writer and returns the time
132 // for the next delayed packet to be written. 126 // for the next delayed packet to be written.
133 QuicTime ReleaseNextPacket(); 127 QuicTime ReleaseNextPacket();
134 128
135 // A single packet which will be sent at the supplied send_time. 129 // A single packet which will be sent at the supplied send_time.
136 struct DelayedWrite { 130 struct DelayedWrite {
137 public: 131 public:
138 DelayedWrite(const char* buffer, 132 DelayedWrite(const char* buffer,
139 size_t buf_len, 133 size_t buf_len,
(...skipping 21 matching lines...) Expand all
161 155
162 const QuicClock* clock_; 156 const QuicClock* clock_;
163 std::unique_ptr<QuicAlarm> write_unblocked_alarm_; 157 std::unique_ptr<QuicAlarm> write_unblocked_alarm_;
164 std::unique_ptr<QuicAlarm> delay_alarm_; 158 std::unique_ptr<QuicAlarm> delay_alarm_;
165 std::unique_ptr<Delegate> on_can_write_; 159 std::unique_ptr<Delegate> on_can_write_;
166 net::test::SimpleRandom simple_random_; 160 net::test::SimpleRandom simple_random_;
167 // Stored packets delayed by fake packet delay or bandwidth restrictions. 161 // Stored packets delayed by fake packet delay or bandwidth restrictions.
168 DelayedPacketList delayed_packets_; 162 DelayedPacketList delayed_packets_;
169 QuicByteCount cur_buffer_size_; 163 QuicByteCount cur_buffer_size_;
170 uint64_t num_calls_to_write_; 164 uint64_t num_calls_to_write_;
171 QuicByteCount max_allowed_packet_size_;
172 165
173 base::Lock config_mutex_; 166 base::Lock config_mutex_;
174 int32_t fake_packet_loss_percentage_; 167 int32_t fake_packet_loss_percentage_;
175 int32_t fake_drop_first_n_packets_; 168 int32_t fake_drop_first_n_packets_;
176 int32_t fake_blocked_socket_percentage_; 169 int32_t fake_blocked_socket_percentage_;
177 int32_t fake_packet_reorder_percentage_; 170 int32_t fake_packet_reorder_percentage_;
178 QuicTime::Delta fake_packet_delay_; 171 QuicTime::Delta fake_packet_delay_;
179 QuicBandwidth fake_bandwidth_; 172 QuicBandwidth fake_bandwidth_;
180 QuicByteCount buffer_size_; 173 QuicByteCount buffer_size_;
181 174
182 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); 175 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter);
183 }; 176 };
184 177
185 } // namespace test 178 } // namespace test
186 } // namespace net 179 } // namespace net
187 180
188 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ 181 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server.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