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

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

Issue 2334363002: Landing Recent QUIC changes until Sat Sep 10 00:32:41 (Closed)
Patch Set: Revase Created 4 years, 3 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/test_tools/crypto_test_utils.cc ('k') | net/quic/test_tools/quic_framer_peer.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 "net/quic/core/crypto/crypto_server_config_protobuf.h" 7 #include "net/quic/core/crypto/crypto_server_config_protobuf.h"
8 #include "net/quic/core/quic_utils.h" 8 #include "net/quic/core/quic_utils.h"
9 #include "net/quic/test_tools/mock_clock.h" 9 #include "net/quic/test_tools/mock_clock.h"
10 #include "net/test/gtest_util.h" 10 #include "net/test/gtest_util.h"
(...skipping 14 matching lines...) Expand all
25 QuicCryptoProof* proof, 25 QuicCryptoProof* proof,
26 QuicCompressedCertsCache* compressed_certs_cache) 26 QuicCompressedCertsCache* compressed_certs_cache)
27 : crypto_config_(crypto_config), 27 : crypto_config_(crypto_config),
28 server_ip_(server_ip), 28 server_ip_(server_ip),
29 client_addr_(client_addr), 29 client_addr_(client_addr),
30 clock_(clock), 30 clock_(clock),
31 proof_(proof), 31 proof_(proof),
32 compressed_certs_cache_(compressed_certs_cache) {} 32 compressed_certs_cache_(compressed_certs_cache) {}
33 33
34 // Verify that the output message is a SHLO. 34 // Verify that the output message is a SHLO.
35 void RunImpl(const CryptoHandshakeMessage& chlo, 35 void Run(std::unique_ptr<ValidateClientHelloResultCallback::Result> result,
36 const ValidateClientHelloResultCallback::Result& result, 36 std::unique_ptr<ProofSource::Details> /* details */) override {
37 std::unique_ptr<ProofSource::Details> /* details */) override {
38 QuicCryptoNegotiatedParameters params; 37 QuicCryptoNegotiatedParameters params;
39 string error_details; 38 string error_details;
40 DiversificationNonce diversification_nonce; 39 DiversificationNonce diversification_nonce;
41 CryptoHandshakeMessage out; 40 CryptoHandshakeMessage out;
42 crypto_config_->ProcessClientHello( 41 crypto_config_->ProcessClientHello(
43 result, /*reject_only=*/false, /*connection_id=*/1, server_ip_, 42 *result, /*reject_only=*/false, /*connection_id=*/1, server_ip_,
44 client_addr_, AllSupportedVersions().front(), AllSupportedVersions(), 43 client_addr_, AllSupportedVersions().front(), AllSupportedVersions(),
45 /*use_stateless_rejects=*/true, /*server_designated_connection_id=*/0, 44 /*use_stateless_rejects=*/true, /*server_designated_connection_id=*/0,
46 clock_, QuicRandom::GetInstance(), compressed_certs_cache_, &params, 45 clock_, QuicRandom::GetInstance(), compressed_certs_cache_, &params,
47 proof_, /*total_framing_overhead=*/50, kDefaultMaxPacketSize, &out, 46 proof_, /*total_framing_overhead=*/50, kDefaultMaxPacketSize, &out,
48 &diversification_nonce, &error_details); 47 &diversification_nonce, &error_details);
49 // Verify output is a SHLO. 48 // Verify output is a SHLO.
50 EXPECT_EQ(out.tag(), kSHLO) << "Fail to pass validation. Get " 49 EXPECT_EQ(out.tag(), kSHLO) << "Fail to pass validation. Get "
51 << out.DebugString(); 50 << out.DebugString();
52 } 51 }
53 52
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 "$padding", static_cast<int>(kClientHelloMinimumSize), 111 "$padding", static_cast<int>(kClientHelloMinimumSize),
113 nullptr); 112 nullptr);
114 // clang-format on 113 // clang-format on
115 114
116 CryptoTestUtils::GenerateFullCHLO(inchoate_chlo, &crypto_config, server_ip, 115 CryptoTestUtils::GenerateFullCHLO(inchoate_chlo, &crypto_config, server_ip,
117 client_addr, version, &clock, &proof, 116 client_addr, version, &clock, &proof,
118 &compressed_certs_cache, &full_chlo); 117 &compressed_certs_cache, &full_chlo);
119 // Verify that full_chlo can pass crypto_config's verification. 118 // Verify that full_chlo can pass crypto_config's verification.
120 crypto_config.ValidateClientHello( 119 crypto_config.ValidateClientHello(
121 full_chlo, client_addr.address(), server_ip, version, &clock, &proof, 120 full_chlo, client_addr.address(), server_ip, version, &clock, &proof,
122 new ShloVerifier(&crypto_config, server_ip, client_addr, &clock, &proof, 121 std::unique_ptr<ShloVerifier>(
123 &compressed_certs_cache)); 122 new ShloVerifier(&crypto_config, server_ip, client_addr, &clock,
123 &proof, &compressed_certs_cache)));
124 } 124 }
125 125
126 } // namespace test 126 } // namespace test
127 } // namespace net 127 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils.cc ('k') | net/quic/test_tools/quic_framer_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698