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

Side by Side Diff: net/quic/test_tools/crypto_test_utils.cc

Issue 2679783003: Deprecate FLAGS_quic_reloadable_flag_enable_async_get_proof (Closed)
Patch Set: Address gredner's comments. Created 3 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/quartc/quartc_session_test.cc ('k') | net/quic/test_tools/failing_proof_source.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) 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/crypto_test_utils.h" 5 #include "net/quic/test_tools/crypto_test_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "crypto/openssl_util.h" 9 #include "crypto/openssl_util.h"
10 #include "crypto/secure_hash.h" 10 #include "crypto/secure_hash.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 return string(); 557 return string();
558 } 558 }
559 return it->second; 559 return it->second;
560 } 560 }
561 561
562 uint64_t LeafCertHashForTesting() { 562 uint64_t LeafCertHashForTesting() {
563 QuicReferenceCountedPointer<ProofSource::Chain> chain; 563 QuicReferenceCountedPointer<ProofSource::Chain> chain;
564 QuicSocketAddress server_address; 564 QuicSocketAddress server_address;
565 QuicCryptoProof proof; 565 QuicCryptoProof proof;
566 std::unique_ptr<ProofSource> proof_source(ProofSourceForTesting()); 566 std::unique_ptr<ProofSource> proof_source(ProofSourceForTesting());
567 if (!proof_source->GetProof(server_address, "", "", 567
568 AllSupportedVersions().front(), "", 568 class Callback : public ProofSource::Callback {
569 QuicTagVector(), &chain, &proof) || 569 public:
570 chain->certs.empty()) { 570 Callback(bool* ok, QuicReferenceCountedPointer<ProofSource::Chain>* chain)
571 : ok_(ok), chain_(chain) {}
572
573 void Run(bool ok,
574 const QuicReferenceCountedPointer<ProofSource::Chain>& chain,
575 const QuicCryptoProof& /* proof */,
576 std::unique_ptr<ProofSource::Details> /* details */) override {
577 *ok_ = ok;
578 *chain_ = chain;
579 }
580
581 private:
582 bool* ok_;
583 QuicReferenceCountedPointer<ProofSource::Chain>* chain_;
584 };
585
586 // Note: relies on the callback being invoked synchronously
587 bool ok = false;
588 proof_source->GetProof(
589 server_address, "", "", AllSupportedVersions().front(), "",
590 QuicTagVector(),
591 std::unique_ptr<ProofSource::Callback>(new Callback(&ok, &chain)));
592 if (!ok || chain->certs.empty()) {
571 DCHECK(false) << "Proof generation failed"; 593 DCHECK(false) << "Proof generation failed";
572 return 0; 594 return 0;
573 } 595 }
574 596
575 return QuicUtils::FNV1a_64_Hash(chain->certs.at(0)); 597 return QuicUtils::FNV1a_64_Hash(chain->certs.at(0));
576 } 598 }
577 599
578 class MockCommonCertSets : public CommonCertSets { 600 class MockCommonCertSets : public CommonCertSets {
579 public: 601 public:
580 MockCommonCertSets(StringPiece cert, uint64_t hash, uint32_t index) 602 MockCommonCertSets(StringPiece cert, uint64_t hash, uint32_t index)
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 FullChloGenerator generator(crypto_config, server_addr, client_addr, clock, 1018 FullChloGenerator generator(crypto_config, server_addr, client_addr, clock,
997 proof, compressed_certs_cache, out); 1019 proof, compressed_certs_cache, out);
998 crypto_config->ValidateClientHello( 1020 crypto_config->ValidateClientHello(
999 inchoate_chlo, client_addr.host(), server_addr, version, clock, proof, 1021 inchoate_chlo, client_addr.host(), server_addr, version, clock, proof,
1000 generator.GetValidateClientHelloCallback()); 1022 generator.GetValidateClientHelloCallback());
1001 } 1023 }
1002 1024
1003 } // namespace crypto_test_utils 1025 } // namespace crypto_test_utils
1004 } // namespace test 1026 } // namespace test
1005 } // namespace net 1027 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quartc/quartc_session_test.cc ('k') | net/quic/test_tools/failing_proof_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698