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

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

Issue 2126023002: use std::unique_ptr for the callback argument of QUIC's ProofVerifier::Verify proof to make ownersh… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@126327823
Patch Set: Created 4 years, 5 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
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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 ASSERT_TRUE(CertCompressor::DecompressChain(cert, cached_certs, 829 ASSERT_TRUE(CertCompressor::DecompressChain(cert, cached_certs,
830 common_cert_sets, &certs)); 830 common_cert_sets, &certs));
831 831
832 // Check that the proof in the REJ message is valid. 832 // Check that the proof in the REJ message is valid.
833 std::unique_ptr<ProofVerifier> proof_verifier( 833 std::unique_ptr<ProofVerifier> proof_verifier(
834 CryptoTestUtils::ProofVerifierForTesting()); 834 CryptoTestUtils::ProofVerifierForTesting());
835 std::unique_ptr<ProofVerifyContext> verify_context( 835 std::unique_ptr<ProofVerifyContext> verify_context(
836 CryptoTestUtils::ProofVerifyContextForTesting()); 836 CryptoTestUtils::ProofVerifyContextForTesting());
837 std::unique_ptr<ProofVerifyDetails> details; 837 std::unique_ptr<ProofVerifyDetails> details;
838 string error_details; 838 string error_details;
839 DummyProofVerifierCallback callback; 839 std::unique_ptr<ProofVerifierCallback> callback(
840 new DummyProofVerifierCallback());
840 string chlo_hash; 841 string chlo_hash;
841 CryptoUtils::HashHandshakeMessage(msg, &chlo_hash); 842 CryptoUtils::HashHandshakeMessage(msg, &chlo_hash);
842 EXPECT_EQ(QUIC_SUCCESS, 843 EXPECT_EQ(QUIC_SUCCESS,
843 proof_verifier->VerifyProof( 844 proof_verifier->VerifyProof(
844 "test.example.com", 443, scfg_str.as_string(), client_version_, 845 "test.example.com", 443, scfg_str.as_string(), client_version_,
845 chlo_hash, certs, "", proof.as_string(), verify_context.get(), 846 chlo_hash, certs, "", proof.as_string(), verify_context.get(),
846 &error_details, &details, &callback)); 847 &error_details, &details, std::move(callback)));
847 } 848 }
848 849
849 TEST_P(CryptoServerTest, RejectInvalidXlct) { 850 TEST_P(CryptoServerTest, RejectInvalidXlct) {
850 if (client_version_ <= QUIC_VERSION_25) { 851 if (client_version_ <= QUIC_VERSION_25) {
851 // XLCT tag introduced in QUIC_VERSION_26. 852 // XLCT tag introduced in QUIC_VERSION_26.
852 return; 853 return;
853 } 854 }
854 // clang-format off 855 // clang-format off
855 CryptoHandshakeMessage msg = CryptoTestUtils::Message( 856 CryptoHandshakeMessage msg = CryptoTestUtils::Message(
856 "CHLO", 857 "CHLO",
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 1157
1157 strike_register_client_->RunPendingVerifications(); 1158 strike_register_client_->RunPendingVerifications();
1158 ASSERT_TRUE(called); 1159 ASSERT_TRUE(called);
1159 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); 1160 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
1160 // The message should be rejected now. 1161 // The message should be rejected now.
1161 CheckRejectTag(); 1162 CheckRejectTag();
1162 } 1163 }
1163 1164
1164 } // namespace test 1165 } // namespace test
1165 } // namespace net 1166 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/crypto/proof_test.cc » ('j') | net/quic/crypto/proof_verifier_chromium.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698