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

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

Issue 110373004: Remove redundant |is_server| argument from TestSession and call the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_crypto_server_stream_test.cc ('k') | net/quic/test_tools/quic_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) 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 CryptoTestUtils::FakeClientOptions::FakeClientOptions() 127 CryptoTestUtils::FakeClientOptions::FakeClientOptions()
128 : dont_verify_certs(false), 128 : dont_verify_certs(false),
129 channel_id_enabled(false) { 129 channel_id_enabled(false) {
130 } 130 }
131 131
132 // static 132 // static
133 int CryptoTestUtils::HandshakeWithFakeServer( 133 int CryptoTestUtils::HandshakeWithFakeServer(
134 PacketSavingConnection* client_conn, 134 PacketSavingConnection* client_conn,
135 QuicCryptoClientStream* client) { 135 QuicCryptoClientStream* client) {
136 PacketSavingConnection* server_conn = new PacketSavingConnection(true); 136 PacketSavingConnection* server_conn = new PacketSavingConnection(true);
137 TestSession server_session(server_conn, DefaultQuicConfig(), true); 137 TestSession server_session(server_conn, DefaultQuicConfig());
138 138
139 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING, 139 QuicCryptoServerConfig crypto_config(QuicCryptoServerConfig::TESTING,
140 QuicRandom::GetInstance()); 140 QuicRandom::GetInstance());
141 SetupCryptoServerConfigForTest( 141 SetupCryptoServerConfigForTest(
142 server_session.connection()->clock(), 142 server_session.connection()->clock(),
143 server_session.connection()->random_generator(), 143 server_session.connection()->random_generator(),
144 server_session.config(), &crypto_config); 144 server_session.config(), &crypto_config);
145 145
146 QuicCryptoServerStream server(crypto_config, &server_session); 146 QuicCryptoServerStream server(crypto_config, &server_session);
147 server_session.SetCryptoStream(&server); 147 server_session.SetCryptoStream(&server);
148 148
149 // The client's handshake must have been started already. 149 // The client's handshake must have been started already.
150 CHECK_NE(0u, client_conn->packets_.size()); 150 CHECK_NE(0u, client_conn->packets_.size());
151 151
152 CommunicateHandshakeMessages(client_conn, client, server_conn, &server); 152 CommunicateHandshakeMessages(client_conn, client, server_conn, &server);
153 153
154 CompareClientAndServerKeys(client, &server); 154 CompareClientAndServerKeys(client, &server);
155 155
156 return client->num_sent_client_hellos(); 156 return client->num_sent_client_hellos();
157 } 157 }
158 158
159 // static 159 // static
160 int CryptoTestUtils::HandshakeWithFakeClient( 160 int CryptoTestUtils::HandshakeWithFakeClient(
161 PacketSavingConnection* server_conn, 161 PacketSavingConnection* server_conn,
162 QuicCryptoServerStream* server, 162 QuicCryptoServerStream* server,
163 const FakeClientOptions& options) { 163 const FakeClientOptions& options) {
164 PacketSavingConnection* client_conn = new PacketSavingConnection(false); 164 PacketSavingConnection* client_conn = new PacketSavingConnection(false);
165 TestSession client_session(client_conn, DefaultQuicConfig(), false); 165 TestSession client_session(client_conn, DefaultQuicConfig());
166 QuicCryptoClientConfig crypto_config; 166 QuicCryptoClientConfig crypto_config;
167 167
168 client_session.config()->SetDefaults(); 168 client_session.config()->SetDefaults();
169 crypto_config.SetDefaults(); 169 crypto_config.SetDefaults();
170 // TODO(rtenneti): Enable testing of ProofVerifier. 170 // TODO(rtenneti): Enable testing of ProofVerifier.
171 // if (!options.dont_verify_certs) { 171 // if (!options.dont_verify_certs) {
172 // crypto_config.SetProofVerifier(ProofVerifierForTesting()); 172 // crypto_config.SetProofVerifier(ProofVerifierForTesting());
173 // } 173 // }
174 if (options.channel_id_enabled) { 174 if (options.channel_id_enabled) {
175 crypto_config.SetChannelIDSigner(ChannelIDSignerForTesting()); 175 crypto_config.SetChannelIDSigner(ChannelIDSignerForTesting());
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg)); 510 scoped_ptr<QuicData> bytes(CryptoFramer::ConstructHandshakeMessage(msg));
511 scoped_ptr<CryptoHandshakeMessage> parsed( 511 scoped_ptr<CryptoHandshakeMessage> parsed(
512 CryptoFramer::ParseMessage(bytes->AsStringPiece())); 512 CryptoFramer::ParseMessage(bytes->AsStringPiece()));
513 CHECK(parsed.get()); 513 CHECK(parsed.get());
514 514
515 return *parsed; 515 return *parsed;
516 } 516 }
517 517
518 } // namespace test 518 } // namespace test
519 } // namespace net 519 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_server_stream_test.cc ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698