| OLD | NEW |
| 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 "net/quic/test_tools/mock_crypto_client_stream.h" | 5 #include "net/quic/test_tools/mock_crypto_client_stream.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 MockCryptoClientStream::MockCryptoClientStream( | 9 MockCryptoClientStream::MockCryptoClientStream( |
| 10 const string& server_hostname, | 10 const string& server_hostname, |
| 11 const QuicConfig& config, | 11 const QuicConfig& config, |
| 12 QuicSession* session, | 12 QuicSession* session, |
| 13 QuicCryptoClientConfig* crypto_config) | 13 QuicCryptoClientConfig* crypto_config, |
| 14 : QuicCryptoClientStream(server_hostname, config, session, crypto_config) { | 14 HandshakeMode handshake_mode) |
| 15 : QuicCryptoClientStream(server_hostname, config, session, crypto_config), |
| 16 handshake_mode_(handshake_mode) { |
| 15 } | 17 } |
| 16 | 18 |
| 17 MockCryptoClientStream::~MockCryptoClientStream() { | 19 MockCryptoClientStream::~MockCryptoClientStream() { |
| 18 } | 20 } |
| 19 | 21 |
| 20 void MockCryptoClientStream::OnHandshakeMessage( | 22 void MockCryptoClientStream::OnHandshakeMessage( |
| 21 const CryptoHandshakeMessage& message) { | 23 const CryptoHandshakeMessage& message) { |
| 22 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); | 24 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); |
| 23 } | 25 } |
| 24 | 26 |
| 25 bool MockCryptoClientStream::CryptoConnect() { | 27 bool MockCryptoClientStream::CryptoConnect() { |
| 26 SetHandshakeComplete(QUIC_NO_ERROR); | 28 if (handshake_mode_ == ZERO_RTT) { |
| 29 encryption_established_ = true; |
| 30 handshake_confirmed_ = false; |
| 31 session()->OnCryptoHandshakeEvent( |
| 32 QuicSession::ENCRYPTION_FIRST_ESTABLISHED); |
| 33 return true; |
| 34 } |
| 35 |
| 36 encryption_established_ = true; |
| 37 handshake_confirmed_ = true; |
| 38 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); |
| 27 return true; | 39 return true; |
| 28 } | 40 } |
| 29 | 41 |
| 30 } // namespace net | 42 } // namespace net |
| OLD | NEW |