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

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

Issue 647933002: Call SetDefaults from the QuicConfig constructor instead of requiring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Allow_number_of_undecryptable_packets_76707156
Patch Set: Created 6 years, 2 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_stream_factory.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('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/crypto/channel_id.h" 7 #include "net/quic/crypto/channel_id.h"
8 #include "net/quic/crypto/common_cert_set.h" 8 #include "net/quic/crypto/common_cert_set.h"
9 #include "net/quic/crypto/crypto_handshake.h" 9 #include "net/quic/crypto/crypto_handshake.h"
10 #include "net/quic/crypto/quic_crypto_server_config.h" 10 #include "net/quic/crypto/quic_crypto_server_config.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 // static 213 // static
214 int CryptoTestUtils::HandshakeWithFakeClient( 214 int CryptoTestUtils::HandshakeWithFakeClient(
215 PacketSavingConnection* server_conn, 215 PacketSavingConnection* server_conn,
216 QuicCryptoServerStream* server, 216 QuicCryptoServerStream* server,
217 const FakeClientOptions& options) { 217 const FakeClientOptions& options) {
218 PacketSavingConnection* client_conn = new PacketSavingConnection(false); 218 PacketSavingConnection* client_conn = new PacketSavingConnection(false);
219 TestClientSession client_session(client_conn, DefaultQuicConfig()); 219 TestClientSession client_session(client_conn, DefaultQuicConfig());
220 QuicCryptoClientConfig crypto_config; 220 QuicCryptoClientConfig crypto_config;
221 221
222 client_session.config()->SetDefaults();
223 crypto_config.SetDefaults();
224 if (!options.dont_verify_certs) { 222 if (!options.dont_verify_certs) {
225 // TODO(wtc): replace this with ProofVerifierForTesting() when we have 223 // TODO(wtc): replace this with ProofVerifierForTesting() when we have
226 // a working ProofSourceForTesting(). 224 // a working ProofSourceForTesting().
227 crypto_config.SetProofVerifier(FakeProofVerifierForTesting()); 225 crypto_config.SetProofVerifier(FakeProofVerifierForTesting());
228 } 226 }
229 bool is_https = false; 227 bool is_https = false;
230 AsyncTestChannelIDSource* async_channel_id_source = nullptr; 228 AsyncTestChannelIDSource* async_channel_id_source = nullptr;
231 if (options.channel_id_enabled) { 229 if (options.channel_id_enabled) {
232 is_https = true; 230 is_https = true;
233 231
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 264
267 return client.num_sent_client_hellos(); 265 return client.num_sent_client_hellos();
268 } 266 }
269 267
270 // static 268 // static
271 void CryptoTestUtils::SetupCryptoServerConfigForTest( 269 void CryptoTestUtils::SetupCryptoServerConfigForTest(
272 const QuicClock* clock, 270 const QuicClock* clock,
273 QuicRandom* rand, 271 QuicRandom* rand,
274 QuicConfig* config, 272 QuicConfig* config,
275 QuicCryptoServerConfig* crypto_config) { 273 QuicCryptoServerConfig* crypto_config) {
276 config->SetDefaults();
277 QuicCryptoServerConfig::ConfigOptions options; 274 QuicCryptoServerConfig::ConfigOptions options;
278 options.channel_id_enabled = true; 275 options.channel_id_enabled = true;
279 scoped_ptr<CryptoHandshakeMessage> scfg( 276 scoped_ptr<CryptoHandshakeMessage> scfg(
280 crypto_config->AddDefaultConfig(rand, clock, options)); 277 crypto_config->AddDefaultConfig(rand, clock, options));
281 } 278 }
282 279
283 // static 280 // static
284 void CryptoTestUtils::CommunicateHandshakeMessages( 281 void CryptoTestUtils::CommunicateHandshakeMessages(
285 PacketSavingConnection* a_conn, 282 PacketSavingConnection* a_conn,
286 QuicCryptoStream* a, 283 QuicCryptoStream* a,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); 624 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg));
628 scoped_ptr<CryptoHandshakeMessage> parsed( 625 scoped_ptr<CryptoHandshakeMessage> parsed(
629 CryptoFramer::ParseMessage(bytes->AsStringPiece())); 626 CryptoFramer::ParseMessage(bytes->AsStringPiece()));
630 CHECK(parsed.get()); 627 CHECK(parsed.get());
631 628
632 return *parsed; 629 return *parsed;
633 } 630 }
634 631
635 } // namespace test 632 } // namespace test
636 } // namespace net 633 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698