| 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 #include "net/quic/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 if (identical) | 720 if (identical) |
| 721 return; | 721 return; |
| 722 ADD_FAILURE() << "Description:\n" | 722 ADD_FAILURE() << "Description:\n" |
| 723 << description << "\n\nExpected:\n" | 723 << description << "\n\nExpected:\n" |
| 724 << HexDumpWithMarks(expected, expected_len, marks.get(), | 724 << HexDumpWithMarks(expected, expected_len, marks.get(), |
| 725 max_len) | 725 max_len) |
| 726 << "\nActual:\n" | 726 << "\nActual:\n" |
| 727 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len); | 727 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len); |
| 728 } | 728 } |
| 729 | 729 |
| 730 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) { | |
| 731 bytes->clear(); | |
| 732 if (hex.empty()) | |
| 733 return true; | |
| 734 std::vector<uint8_t> v; | |
| 735 if (!base::HexStringToBytes(hex.as_string(), &v)) | |
| 736 return false; | |
| 737 if (!v.empty()) | |
| 738 bytes->assign(reinterpret_cast<const char*>(&v[0]), v.size()); | |
| 739 return true; | |
| 740 } | |
| 741 | |
| 742 static QuicPacket* ConstructPacketFromHandshakeMessage( | 730 static QuicPacket* ConstructPacketFromHandshakeMessage( |
| 743 QuicConnectionId connection_id, | 731 QuicConnectionId connection_id, |
| 744 const CryptoHandshakeMessage& message, | 732 const CryptoHandshakeMessage& message, |
| 745 bool should_include_version) { | 733 bool should_include_version) { |
| 746 CryptoFramer crypto_framer; | 734 CryptoFramer crypto_framer; |
| 747 std::unique_ptr<QuicData> data( | 735 std::unique_ptr<QuicData> data( |
| 748 crypto_framer.ConstructHandshakeMessage(message)); | 736 crypto_framer.ConstructHandshakeMessage(message)); |
| 749 QuicFramer quic_framer(AllSupportedVersions(), QuicTime::Zero(), | 737 QuicFramer quic_framer(AllSupportedVersions(), QuicTime::Zero(), |
| 750 Perspective::IS_CLIENT); | 738 Perspective::IS_CLIENT); |
| 751 | 739 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 // strike register worries that we've just overflowed a uint32_t time. | 883 // strike register worries that we've just overflowed a uint32_t time. |
| 896 (*server_connection)->AdvanceTime(connection_start_time); | 884 (*server_connection)->AdvanceTime(connection_start_time); |
| 897 } | 885 } |
| 898 | 886 |
| 899 QuicStreamId QuicClientDataStreamId(int i) { | 887 QuicStreamId QuicClientDataStreamId(int i) { |
| 900 return kClientDataStreamId1 + 2 * i; | 888 return kClientDataStreamId1 + 2 * i; |
| 901 } | 889 } |
| 902 | 890 |
| 903 } // namespace test | 891 } // namespace test |
| 904 } // namespace net | 892 } // namespace net |
| OLD | NEW |