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/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 DCHECK_NE(0u, length); | 90 DCHECK_NE(0u, length); |
91 // Re-construct the data packet with data ownership. | 91 // Re-construct the data packet with data ownership. |
92 return new QuicPacket(buffer, length, /* owns_buffer */ true, | 92 return new QuicPacket(buffer, length, /* owns_buffer */ true, |
93 header.public_header.connection_id_length, | 93 header.public_header.connection_id_length, |
94 header.public_header.version_flag, | 94 header.public_header.version_flag, |
95 header.public_header.multipath_flag, | 95 header.public_header.multipath_flag, |
96 header.public_header.nonce != nullptr, | 96 header.public_header.nonce != nullptr, |
97 header.public_header.packet_number_length); | 97 header.public_header.packet_number_length); |
98 } | 98 } |
99 | 99 |
| 100 QuicFlagSaver::QuicFlagSaver() { |
| 101 #define QUIC_FLAG(type, flag, value) CHECK_EQ(value, flag); |
| 102 #include "net/quic/core/quic_flags_list.h" |
| 103 #undef QUIC_FLAG |
| 104 } |
| 105 |
| 106 QuicFlagSaver::~QuicFlagSaver() { |
| 107 #define QUIC_FLAG(type, flag, value) flag = value; |
| 108 #include "net/quic/core/quic_flags_list.h" |
| 109 #undef QUIC_FLAG |
| 110 } |
| 111 |
100 uint64_t SimpleRandom::RandUint64() { | 112 uint64_t SimpleRandom::RandUint64() { |
101 unsigned char hash[base::kSHA1Length]; | 113 unsigned char hash[base::kSHA1Length]; |
102 base::SHA1HashBytes(reinterpret_cast<unsigned char*>(&seed_), sizeof(seed_), | 114 base::SHA1HashBytes(reinterpret_cast<unsigned char*>(&seed_), sizeof(seed_), |
103 hash); | 115 hash); |
104 memcpy(&seed_, hash, sizeof(seed_)); | 116 memcpy(&seed_, hash, sizeof(seed_)); |
105 return seed_; | 117 return seed_; |
106 } | 118 } |
107 | 119 |
108 MockFramerVisitor::MockFramerVisitor() { | 120 MockFramerVisitor::MockFramerVisitor() { |
109 // By default, we want to accept packets. | 121 // By default, we want to accept packets. |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 // strike register worries that we've just overflowed a uint32_t time. | 912 // strike register worries that we've just overflowed a uint32_t time. |
901 (*server_connection)->AdvanceTime(connection_start_time); | 913 (*server_connection)->AdvanceTime(connection_start_time); |
902 } | 914 } |
903 | 915 |
904 QuicStreamId QuicClientDataStreamId(int i) { | 916 QuicStreamId QuicClientDataStreamId(int i) { |
905 return kClientDataStreamId1 + 2 * i; | 917 return kClientDataStreamId1 + 2 * i; |
906 } | 918 } |
907 | 919 |
908 } // namespace test | 920 } // namespace test |
909 } // namespace net | 921 } // namespace net |
OLD | NEW |