| OLD | NEW |
| 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/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/crypto/crypto_framer.h" | 8 #include "net/quic/crypto/crypto_framer.h" |
| 9 #include "net/quic/crypto/crypto_handshake.h" |
| 9 #include "net/quic/crypto/crypto_utils.h" | 10 #include "net/quic/crypto/crypto_utils.h" |
| 10 | 11 |
| 11 using std::max; | 12 using std::max; |
| 12 using std::min; | 13 using std::min; |
| 13 using std::string; | 14 using std::string; |
| 14 using testing::_; | 15 using testing::_; |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 namespace test { | 18 namespace test { |
| 18 | 19 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 QuicPacket* ConstructHandshakePacket(QuicGuid guid, CryptoTag tag) { | 269 QuicPacket* ConstructHandshakePacket(QuicGuid guid, CryptoTag tag) { |
| 269 CryptoHandshakeMessage message; | 270 CryptoHandshakeMessage message; |
| 270 message.tag = tag; | 271 message.tag = tag; |
| 271 return ConstructPacketFromHandshakeMessage(guid, message); | 272 return ConstructPacketFromHandshakeMessage(guid, message); |
| 272 } | 273 } |
| 273 | 274 |
| 274 QuicPacket* ConstructClientHelloPacket(QuicGuid guid, | 275 QuicPacket* ConstructClientHelloPacket(QuicGuid guid, |
| 275 const QuicClock* clock, | 276 const QuicClock* clock, |
| 276 QuicRandom* random_generator, | 277 QuicRandom* random_generator, |
| 277 const string& server_hostname) { | 278 const string& server_hostname) { |
| 278 QuicCryptoConfig config; | 279 QuicCryptoClientConfig config; |
| 279 config.SetClientDefaults(); | 280 config.SetDefaults(); |
| 280 string nonce; | 281 string nonce; |
| 281 CryptoUtils::GenerateNonce(clock, random_generator, &nonce); | 282 CryptoUtils::GenerateNonce(clock, random_generator, &nonce); |
| 282 | 283 |
| 283 CryptoHandshakeMessage message; | 284 CryptoHandshakeMessage message; |
| 284 CryptoUtils::FillClientHelloMessage(config, nonce, server_hostname, | 285 config.FillClientHello(nonce, server_hostname, &message); |
| 285 &message); | |
| 286 return ConstructPacketFromHandshakeMessage(guid, message); | 286 return ConstructPacketFromHandshakeMessage(guid, message); |
| 287 } | 287 } |
| 288 | 288 |
| 289 QuicPacket* ConstructServerHelloPacket(QuicGuid guid, | 289 QuicPacket* ConstructServerHelloPacket(QuicGuid guid, |
| 290 const QuicClock* clock, | 290 const QuicClock* clock, |
| 291 QuicRandom* random_generator) { | 291 QuicRandom* random_generator) { |
| 292 QuicCryptoNegotiatedParams negotiated_params; | |
| 293 negotiated_params.SetDefaults(); | |
| 294 string nonce; | 292 string nonce; |
| 295 CryptoUtils::GenerateNonce(clock, random_generator, &nonce); | 293 CryptoUtils::GenerateNonce(clock, random_generator, &nonce); |
| 296 | 294 |
| 297 CryptoHandshakeMessage message; | 295 CryptoHandshakeMessage dummy_client_hello, server_hello; |
| 298 CryptoUtils::FillServerHelloMessage(negotiated_params, nonce, &message); | 296 QuicCryptoServerConfig server_config; |
| 299 return ConstructPacketFromHandshakeMessage(guid, message); | 297 server_config.AddTestingConfig(random_generator, clock); |
| 298 server_config.ProcessClientHello(dummy_client_hello, nonce, &server_hello); |
| 299 return ConstructPacketFromHandshakeMessage(guid, server_hello); |
| 300 } | 300 } |
| 301 | 301 |
| 302 QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash( | 302 QuicPacketEntropyHash TestEntropyCalculator::ReceivedEntropyHash( |
| 303 QuicPacketSequenceNumber sequence_number) const { | 303 QuicPacketSequenceNumber sequence_number) const { |
| 304 return 1u; | 304 return 1u; |
| 305 } | 305 } |
| 306 | 306 |
| 307 } // namespace test | 307 } // namespace test |
| 308 } // namespace net | 308 } // namespace net |
| OLD | NEW |