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 "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 using base::StringPiece; | |
11 using std::string; | 10 using std::string; |
12 | 11 |
13 namespace net { | 12 namespace net { |
14 namespace test { | 13 namespace test { |
15 namespace { | 14 namespace { |
16 | 15 |
17 TEST(QuicUtilsTest, DetermineAddressChangeType) { | 16 TEST(QuicUtilsTest, DetermineAddressChangeType) { |
18 const string kIPv4String1 = "1.2.3.4"; | 17 const string kIPv4String1 = "1.2.3.4"; |
19 const string kIPv4String2 = "1.2.3.5"; | 18 const string kIPv4String2 = "1.2.3.5"; |
20 const string kIPv4String3 = "1.1.3.5"; | 19 const string kIPv4String3 = "1.1.3.5"; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 87 } |
89 return hash; | 88 return hash; |
90 } | 89 } |
91 | 90 |
92 TEST(QuicUtilsHashTest, ReferenceTest) { | 91 TEST(QuicUtilsHashTest, ReferenceTest) { |
93 std::vector<uint8_t> data(32); | 92 std::vector<uint8_t> data(32); |
94 for (size_t i = 0; i < data.size(); ++i) { | 93 for (size_t i = 0; i < data.size(); ++i) { |
95 data[i] = i % 255; | 94 data[i] = i % 255; |
96 } | 95 } |
97 EXPECT_EQ(IncrementalHashReference(data.data(), data.size()), | 96 EXPECT_EQ(IncrementalHashReference(data.data(), data.size()), |
98 QuicUtils::FNV1a_128_Hash(StringPiece( | 97 QuicUtils::FNV1a_128_Hash(QuicStringPiece( |
99 reinterpret_cast<const char*>(data.data()), data.size()))); | 98 reinterpret_cast<const char*>(data.data()), data.size()))); |
100 } | 99 } |
101 | 100 |
102 } // namespace | 101 } // namespace |
103 } // namespace test | 102 } // namespace test |
104 } // namespace net | 103 } // namespace net |
OLD | NEW |