Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: net/quic/quic_utils_test.cc

Issue 1726113002: Deprecate --gfe2_reloadable_flag_quic_utils_use_fast_incremental_hash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@114856985
Patch Set: fix mistake made hand merging Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/quic_utils.h" 5 #include "net/quic/quic_utils.h"
6 6
7 #include "net/quic/crypto/crypto_protocol.h" 7 #include "net/quic/crypto/crypto_protocol.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // kPrime = 309485009821345068724781371 168 // kPrime = 309485009821345068724781371
169 const uint128 kPrime(16777216, 315); 169 const uint128 kPrime(16777216, 315);
170 const uint8_t* octets = reinterpret_cast<const uint8_t*>(data); 170 const uint8_t* octets = reinterpret_cast<const uint8_t*>(data);
171 for (size_t i = 0; i < len; ++i) { 171 for (size_t i = 0; i < len; ++i) {
172 hash = hash ^ uint128(0, octets[i]); 172 hash = hash ^ uint128(0, octets[i]);
173 hash = hash * kPrime; 173 hash = hash * kPrime;
174 } 174 }
175 return hash; 175 return hash;
176 } 176 }
177 177
178 TEST(QuicUtilsHashTest, ReferenceTestSlow) { 178 TEST(QuicUtilsHashTest, ReferenceTest) {
179 FLAGS_quic_utils_use_fast_incremental_hash = false;
180 std::vector<uint8_t> data(32); 179 std::vector<uint8_t> data(32);
181 for (size_t i = 0; i < data.size(); ++i) { 180 for (size_t i = 0; i < data.size(); ++i) {
182 data[i] = i % 255; 181 data[i] = i % 255;
183 }
184 EXPECT_EQ(IncrementalHashReference(data.data(), data.size()),
185 QuicUtils::FNV1a_128_Hash(
186 reinterpret_cast<const char*>(data.data()), data.size()));
187 }
188
189 TEST(QuicUtilsHashTest, ReferenceTestFast) {
190 FLAGS_quic_utils_use_fast_incremental_hash = true;
191 std::vector<uint8_t> data(32);
192 for (size_t i = 0; i < data.size(); ++i) {
193 data[i] = i % 255;
194 } 182 }
195 EXPECT_EQ(IncrementalHashReference(data.data(), data.size()), 183 EXPECT_EQ(IncrementalHashReference(data.data(), data.size()),
196 QuicUtils::FNV1a_128_Hash( 184 QuicUtils::FNV1a_128_Hash(
197 reinterpret_cast<const char*>(data.data()), data.size())); 185 reinterpret_cast<const char*>(data.data()), data.size()));
198 } 186 }
199 187
200 } // namespace 188 } // namespace
201 } // namespace test 189 } // namespace test
202 } // namespace net 190 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698