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

Side by Side Diff: net/quic/crypto/crypto_server_test.cc

Issue 2011983004: Add a new CryptoTestUtils::LeafCertHashForTesting for generating expected leaf cert hashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122750844
Patch Set: Created 4 years, 6 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 | « no previous file | net/quic/test_tools/crypto_test_utils.h » ('j') | 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 <algorithm> 5 #include <algorithm>
6 #include <cstdint> 6 #include <cstdint>
7 #include <memory> 7 #include <memory>
8 #include <ostream> 8 #include <ostream>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ASSERT_EQ(kREJ, out_.tag()) << QuicUtils::TagToString(out_.tag()); 361 ASSERT_EQ(kREJ, out_.tag()) << QuicUtils::TagToString(out_.tag());
362 } 362 }
363 } 363 }
364 364
365 bool RejectsAreStateless() { 365 bool RejectsAreStateless() {
366 return GetParam().enable_stateless_rejects && 366 return GetParam().enable_stateless_rejects &&
367 GetParam().use_stateless_rejects; 367 GetParam().use_stateless_rejects;
368 } 368 }
369 369
370 string XlctHexString() { 370 string XlctHexString() {
371 scoped_refptr<ProofSource::Chain> chain; 371 uint64_t xlct = CryptoTestUtils::LeafCertHashForTesting();
372 IPAddress server_ip;
373 string sig;
374 string cert_sct;
375 std::unique_ptr<ProofSource> proof_source(
376 CryptoTestUtils::ProofSourceForTesting());
377 if (!proof_source->GetProof(server_ip, "", "", client_version_, "", false,
378 &chain, &sig, &cert_sct) ||
379 chain->certs.empty()) {
380 return "#0100000000000000";
381 }
382
383 std::ostringstream xlct_stream;
384 uint64_t xlct = QuicUtils::FNV1a_64_Hash(chain->certs.at(0).c_str(),
385 chain->certs.at(0).length());
386 return "#" + 372 return "#" +
387 QuicUtils::HexEncode(reinterpret_cast<char*>(&xlct), sizeof(xlct)); 373 QuicUtils::HexEncode(reinterpret_cast<char*>(&xlct), sizeof(xlct));
388 } 374 }
389 375
390 protected: 376 protected:
391 QuicRandom* const rand_; 377 QuicRandom* const rand_;
392 MockRandom rand_for_id_generation_; 378 MockRandom rand_for_id_generation_;
393 MockClock clock_; 379 MockClock clock_;
394 IPEndPoint client_address_; 380 IPEndPoint client_address_;
395 QuicVersionVector supported_versions_; 381 QuicVersionVector supported_versions_;
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1175
1190 strike_register_client_->RunPendingVerifications(); 1176 strike_register_client_->RunPendingVerifications();
1191 ASSERT_TRUE(called); 1177 ASSERT_TRUE(called);
1192 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); 1178 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1193 // The message should be rejected now. 1179 // The message should be rejected now.
1194 CheckRejectTag(); 1180 CheckRejectTag();
1195 } 1181 }
1196 1182
1197 } // namespace test 1183 } // namespace test
1198 } // namespace net 1184 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/test_tools/crypto_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698