| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Common utilities for Quic tests | 5 // Common utilities for Quic tests |
| 6 | 6 |
| 7 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 7 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 8 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class EpollServer; | 22 class EpollServer; |
| 23 class IPEndPoint; | 23 class IPEndPoint; |
| 24 | 24 |
| 25 namespace tools { | 25 namespace tools { |
| 26 namespace test { | 26 namespace test { |
| 27 | 27 |
| 28 static const QuicConnectionId kTestConnectionId = 42; | 28 static const QuicConnectionId kTestConnectionId = 42; |
| 29 static const int kTestPort = 123; | 29 static const int kTestPort = 123; |
| 30 static const uint32 kInitialFlowControlWindowForTest = 32 * 1024; // 32 KB | 30 static const uint32 kInitialFlowControlWindowForTest = 32 * 1024; // 32 KB |
| 31 | 31 |
| 32 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| |
| 33 // nack ranges of width 1 packet, starting from |least_unacked|. |
| 34 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, |
| 35 QuicPacketSequenceNumber least_unacked); |
| 36 |
| 32 // Simple random number generator used to compute random numbers suitable | 37 // Simple random number generator used to compute random numbers suitable |
| 33 // for pseudo-randomly dropping packets in tests. It works by computing | 38 // for pseudo-randomly dropping packets in tests. It works by computing |
| 34 // the sha1 hash of the current seed, and using the first 64 bits as | 39 // the sha1 hash of the current seed, and using the first 64 bits as |
| 35 // the next random number, and the next seed. | 40 // the next random number, and the next seed. |
| 36 class SimpleRandom { | 41 class SimpleRandom { |
| 37 public: | 42 public: |
| 38 SimpleRandom() : seed_(0) {} | 43 SimpleRandom() : seed_(0) {} |
| 39 | 44 |
| 40 // Returns a random number in the range [0, kuint64max]. | 45 // Returns a random number in the range [0, kuint64max]. |
| 41 uint64 RandUint64(); | 46 uint64 RandUint64(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 virtual ~MockAckNotifierDelegate(); | 172 virtual ~MockAckNotifierDelegate(); |
| 168 | 173 |
| 169 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); | 174 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); |
| 170 }; | 175 }; |
| 171 | 176 |
| 172 } // namespace test | 177 } // namespace test |
| 173 } // namespace tools | 178 } // namespace tools |
| 174 } // namespace net | 179 } // namespace net |
| 175 | 180 |
| 176 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 181 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |