OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/core/quic_utils.h" | 5 #include "net/quic/core/quic_utils.h" |
6 | 6 |
7 #include "net/quic/core/crypto/crypto_protocol.h" | 7 #include "net/quic/core/crypto/crypto_protocol.h" |
8 #include "net/quic/core/quic_flags.h" | 8 #include "net/quic/core/quic_flags.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 QuicUtils::DetermineAddressChangeType(old_address, new_address)); | 96 QuicUtils::DetermineAddressChangeType(old_address, new_address)); |
97 | 97 |
98 ASSERT_TRUE(address.AssignFromIPLiteral(kIPv4String1)); | 98 ASSERT_TRUE(address.AssignFromIPLiteral(kIPv4String1)); |
99 old_address = IPEndPoint(address, 1234); | 99 old_address = IPEndPoint(address, 1234); |
100 ASSERT_TRUE(address.AssignFromIPLiteral(kIPv4String2)); | 100 ASSERT_TRUE(address.AssignFromIPLiteral(kIPv4String2)); |
101 new_address = IPEndPoint(address, 1234); | 101 new_address = IPEndPoint(address, 1234); |
102 EXPECT_EQ(IPV4_SUBNET_CHANGE, | 102 EXPECT_EQ(IPV4_SUBNET_CHANGE, |
103 QuicUtils::DetermineAddressChangeType(old_address, new_address)); | 103 QuicUtils::DetermineAddressChangeType(old_address, new_address)); |
104 ASSERT_TRUE(address.AssignFromIPLiteral(kIPv4String3)); | 104 ASSERT_TRUE(address.AssignFromIPLiteral(kIPv4String3)); |
105 new_address = IPEndPoint(address, 1234); | 105 new_address = IPEndPoint(address, 1234); |
106 EXPECT_EQ(UNSPECIFIED_CHANGE, | 106 EXPECT_EQ(IPV4_TO_IPV4_CHANGE, |
107 QuicUtils::DetermineAddressChangeType(old_address, new_address)); | 107 QuicUtils::DetermineAddressChangeType(old_address, new_address)); |
108 } | 108 } |
109 | 109 |
110 uint128 IncrementalHashReference(const void* data, size_t len) { | 110 uint128 IncrementalHashReference(const void* data, size_t len) { |
111 // The two constants are defined as part of the hash algorithm. | 111 // The two constants are defined as part of the hash algorithm. |
112 // see http://www.isthe.com/chongo/tech/comp/fnv/ | 112 // see http://www.isthe.com/chongo/tech/comp/fnv/ |
113 // hash = 144066263297769815596495629667062367629 | 113 // hash = 144066263297769815596495629667062367629 |
114 uint128 hash = | 114 uint128 hash = |
115 uint128(UINT64_C(7809847782465536322), UINT64_C(7113472399480571277)); | 115 uint128(UINT64_C(7809847782465536322), UINT64_C(7113472399480571277)); |
116 // kPrime = 309485009821345068724781371 | 116 // kPrime = 309485009821345068724781371 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 "0x0010: 7320 7374 7269 6e67 2073 686f 756c 6420 s.string.should.\n" | 150 "0x0010: 7320 7374 7269 6e67 2073 686f 756c 6420 s.string.should.\n" |
151 "0x0020: 6265 206c 6f6e 6720 656e 6f75 6768 2074 be.long.enough.t\n" | 151 "0x0020: 6265 206c 6f6e 6720 656e 6f75 6768 2074 be.long.enough.t\n" |
152 "0x0030: 6f20 7370 616e 206d 756c 7469 706c 6520 o.span.multiple.\n" | 152 "0x0030: 6f20 7370 616e 206d 756c 7469 706c 6520 o.span.multiple.\n" |
153 "0x0040: 6c69 6e65 7320 6f66 206f 7574 7075 742e lines.of.output.\n" | 153 "0x0040: 6c69 6e65 7320 6f66 206f 7574 7075 742e lines.of.output.\n" |
154 "0x0050: 0102 03 ...\n"); | 154 "0x0050: 0102 03 ...\n"); |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
158 } // namespace test | 158 } // namespace test |
159 } // namespace net | 159 } // namespace net |
OLD | NEW |