| 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_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Upper limit on versions we support. | 35 // Upper limit on versions we support. |
| 36 QuicVersion QuicVersionMax(); | 36 QuicVersion QuicVersionMax(); |
| 37 | 37 |
| 38 // Lower limit on versions we support. | 38 // Lower limit on versions we support. |
| 39 QuicVersion QuicVersionMin(); | 39 QuicVersion QuicVersionMin(); |
| 40 | 40 |
| 41 // Returns an address for 127.0.0.1. | 41 // Returns an address for 127.0.0.1. |
| 42 IPAddressNumber Loopback4(); | 42 IPAddressNumber Loopback4(); |
| 43 | 43 |
| 44 // Create an encrypted packet for testing. |
| 45 QuicEncryptedPacket* ConstructEncryptedPacket( |
| 46 QuicConnectionId connection_id, |
| 47 bool version_flag, |
| 48 bool reset_flag, |
| 49 QuicPacketSequenceNumber sequence_number, |
| 50 const std::string& data); |
| 51 |
| 44 void CompareCharArraysWithHexError(const std::string& description, | 52 void CompareCharArraysWithHexError(const std::string& description, |
| 45 const char* actual, | 53 const char* actual, |
| 46 const int actual_len, | 54 const int actual_len, |
| 47 const char* expected, | 55 const char* expected, |
| 48 const int expected_len); | 56 const int expected_len); |
| 49 | 57 |
| 50 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes); | 58 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes); |
| 51 | 59 |
| 52 // Returns the length of a QuicPacket that is capable of holding either a | 60 // Returns the length of a QuicPacket that is capable of holding either a |
| 53 // stream frame or a minimal ack frame. Sets |*payload_length| to the number | 61 // stream frame or a minimal ack frame. Sets |*payload_length| to the number |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // If the constructor that uses a MockHelper has been used then this method | 297 // If the constructor that uses a MockHelper has been used then this method |
| 290 // will advance the time of the MockClock. | 298 // will advance the time of the MockClock. |
| 291 void AdvanceTime(QuicTime::Delta delta); | 299 void AdvanceTime(QuicTime::Delta delta); |
| 292 | 300 |
| 293 MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, | 301 MOCK_METHOD3(ProcessUdpPacket, void(const IPEndPoint& self_address, |
| 294 const IPEndPoint& peer_address, | 302 const IPEndPoint& peer_address, |
| 295 const QuicEncryptedPacket& packet)); | 303 const QuicEncryptedPacket& packet)); |
| 296 MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); | 304 MOCK_METHOD1(SendConnectionClose, void(QuicErrorCode error)); |
| 297 MOCK_METHOD2(SendConnectionCloseWithDetails, void(QuicErrorCode error, | 305 MOCK_METHOD2(SendConnectionCloseWithDetails, void(QuicErrorCode error, |
| 298 const string& details)); | 306 const string& details)); |
| 307 MOCK_METHOD2(SendConnectionClosePacket, void(QuicErrorCode error, |
| 308 const string& details)); |
| 299 MOCK_METHOD3(SendRstStream, void(QuicStreamId id, | 309 MOCK_METHOD3(SendRstStream, void(QuicStreamId id, |
| 300 QuicRstStreamErrorCode error, | 310 QuicRstStreamErrorCode error, |
| 301 QuicStreamOffset bytes_written)); | 311 QuicStreamOffset bytes_written)); |
| 302 MOCK_METHOD3(SendGoAway, void(QuicErrorCode error, | 312 MOCK_METHOD3(SendGoAway, void(QuicErrorCode error, |
| 303 QuicStreamId last_good_stream_id, | 313 QuicStreamId last_good_stream_id, |
| 304 const string& reason)); | 314 const string& reason)); |
| 305 MOCK_METHOD1(SendBlocked, void(QuicStreamId id)); | 315 MOCK_METHOD1(SendBlocked, void(QuicStreamId id)); |
| 306 MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id, | 316 MOCK_METHOD2(SendWindowUpdate, void(QuicStreamId id, |
| 307 QuicStreamOffset byte_offset)); | 317 QuicStreamOffset byte_offset)); |
| 308 MOCK_METHOD0(OnCanWrite, void()); | 318 MOCK_METHOD0(OnCanWrite, void()); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 492 |
| 483 protected: | 493 protected: |
| 484 // Object is ref counted. | 494 // Object is ref counted. |
| 485 virtual ~MockAckNotifierDelegate(); | 495 virtual ~MockAckNotifierDelegate(); |
| 486 }; | 496 }; |
| 487 | 497 |
| 488 } // namespace test | 498 } // namespace test |
| 489 } // namespace net | 499 } // namespace net |
| 490 | 500 |
| 491 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 501 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |