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 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class EpollServer; | 25 class EpollServer; |
26 class IPEndPoint; | 26 class IPEndPoint; |
27 | 27 |
28 namespace tools { | 28 namespace tools { |
29 namespace test { | 29 namespace test { |
30 | 30 |
31 static const QuicConnectionId kTestConnectionId = 42; | 31 static const QuicConnectionId kTestConnectionId = 42; |
32 static const uint16 kTestPort = 123; | 32 static const uint16 kTestPort = 123; |
33 static const uint32 kInitialStreamFlowControlWindowForTest = | 33 static const uint32 kInitialStreamFlowControlWindowForTest = |
34 32 * 1024; // 32 KB | 34 1024 * 1024; // 1 MB |
35 static const uint32 kInitialSessionFlowControlWindowForTest = | 35 static const uint32 kInitialSessionFlowControlWindowForTest = |
36 64 * 1024; // 64 KB | 36 1536 * 1024; // 1.5 MB |
37 | 37 |
38 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| | 38 // Testing convenience method to construct a QuicAckFrame with |num_nack_ranges| |
39 // nack ranges of width 1 packet, starting from |least_unacked|. | 39 // nack ranges of width 1 packet, starting from |least_unacked|. |
40 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, | 40 QuicAckFrame MakeAckFrameWithNackRanges(size_t num_nack_ranges, |
41 QuicPacketSequenceNumber least_unacked); | 41 QuicPacketSequenceNumber least_unacked); |
42 | 42 |
43 class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory { | 43 class NiceMockPacketWriterFactory : public QuicConnection::PacketWriterFactory { |
44 public: | 44 public: |
45 NiceMockPacketWriterFactory() {} | 45 NiceMockPacketWriterFactory() {} |
46 ~NiceMockPacketWriterFactory() override {} | 46 ~NiceMockPacketWriterFactory() override {} |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 TestWriterFactory* factory_; | 214 TestWriterFactory* factory_; |
215 }; | 215 }; |
216 | 216 |
217 // If an asynchronous write is happening and |writer| gets deleted, this | 217 // If an asynchronous write is happening and |writer| gets deleted, this |
218 // clears the pointer to it to prevent use-after-free. | 218 // clears the pointer to it to prevent use-after-free. |
219 void Unregister(PerConnectionPacketWriter* writer); | 219 void Unregister(PerConnectionPacketWriter* writer); |
220 | 220 |
221 PerConnectionPacketWriter* current_writer_; | 221 PerConnectionPacketWriter* current_writer_; |
222 }; | 222 }; |
223 | 223 |
| 224 class MockTimeWaitListManager : public QuicTimeWaitListManager { |
| 225 public: |
| 226 MockTimeWaitListManager(QuicPacketWriter* writer, |
| 227 QuicServerSessionVisitor* visitor, |
| 228 EpollServer* eps); |
| 229 ~MockTimeWaitListManager() override; |
| 230 |
| 231 MOCK_METHOD5(ProcessPacket, |
| 232 void(const IPEndPoint& server_address, |
| 233 const IPEndPoint& client_address, |
| 234 QuicConnectionId connection_id, |
| 235 QuicPacketSequenceNumber sequence_number, |
| 236 const QuicEncryptedPacket& packet)); |
| 237 }; |
| 238 |
224 } // namespace test | 239 } // namespace test |
225 } // namespace tools | 240 } // namespace tools |
226 } // namespace net | 241 } // namespace net |
227 | 242 |
228 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 243 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |