| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 IPAddressNumber Loopback6(); | 59 IPAddressNumber Loopback6(); |
| 60 | 60 |
| 61 void GenerateBody(std::string* body, int length); | 61 void GenerateBody(std::string* body, int length); |
| 62 | 62 |
| 63 // Create an encrypted packet for testing. | 63 // Create an encrypted packet for testing. |
| 64 QuicEncryptedPacket* ConstructEncryptedPacket( | 64 QuicEncryptedPacket* ConstructEncryptedPacket( |
| 65 QuicConnectionId connection_id, | 65 QuicConnectionId connection_id, |
| 66 bool version_flag, | 66 bool version_flag, |
| 67 bool reset_flag, | 67 bool reset_flag, |
| 68 QuicPacketSequenceNumber sequence_number, | 68 QuicPacketSequenceNumber sequence_number, |
| 69 const std::string& data, |
| 70 QuicConnectionIdLength connection_id_length, |
| 71 QuicSequenceNumberLength sequence_number_length); |
| 72 |
| 73 // This form assumes |connection_id_length| == PACKET_8BYTE_CONNECTION_ID and |
| 74 // |sequence_number_length| == PACKET_6BYTE_SEQUENCE_NUMBER. |
| 75 QuicEncryptedPacket* ConstructEncryptedPacket( |
| 76 QuicConnectionId connection_id, |
| 77 bool version_flag, |
| 78 bool reset_flag, |
| 79 QuicPacketSequenceNumber sequence_number, |
| 69 const std::string& data); | 80 const std::string& data); |
| 70 | 81 |
| 71 void CompareCharArraysWithHexError(const std::string& description, | 82 void CompareCharArraysWithHexError(const std::string& description, |
| 72 const char* actual, | 83 const char* actual, |
| 73 const int actual_len, | 84 const int actual_len, |
| 74 const char* expected, | 85 const char* expected, |
| 75 const int expected_len); | 86 const int expected_len); |
| 76 | 87 |
| 77 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes); | 88 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes); |
| 78 | 89 |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 // clears the pointer to it to prevent use-after-free. | 608 // clears the pointer to it to prevent use-after-free. |
| 598 void Unregister(PerConnectionPacketWriter* writer); | 609 void Unregister(PerConnectionPacketWriter* writer); |
| 599 | 610 |
| 600 PerConnectionPacketWriter* current_writer_; | 611 PerConnectionPacketWriter* current_writer_; |
| 601 }; | 612 }; |
| 602 | 613 |
| 603 } // namespace test | 614 } // namespace test |
| 604 } // namespace net | 615 } // namespace net |
| 605 | 616 |
| 606 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 617 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |