| 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 #ifndef NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ |
| 6 #define NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ | 6 #define NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
| 11 #include "net/quic/quic_crypto_client_stream.h" | 11 #include "net/quic/quic_crypto_client_stream.h" |
| 12 #include "net/quic/quic_session.h" | 12 #include "net/quic/quic_session.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 class MockCryptoClientStream : public QuicCryptoClientStream { | 16 class MockCryptoClientStream : public QuicCryptoClientStream { |
| 17 public: | 17 public: |
| 18 MockCryptoClientStream(const string& server_hostname, | 18 // HandshakeMode enumerates the handshake mode MockCryptoClientStream should |
| 19 const QuicConfig& config, | 19 // mock in CryptoConnect. |
| 20 QuicSession* session, | 20 enum HandshakeMode { |
| 21 QuicCryptoClientConfig* crypto_config); | 21 // CONFIRM_HANDSHAKE indicates that CryptoConnect will immediately confirm |
| 22 // the handshake and establish encryption. |
| 23 CONFIRM_HANDSHAKE, |
| 24 |
| 25 // ZERO_RTT indicates that CryptoConnect will establish encryption but will |
| 26 // not confirm the handshake. |
| 27 ZERO_RTT, |
| 28 }; |
| 29 |
| 30 MockCryptoClientStream( |
| 31 const string& server_hostname, |
| 32 const QuicConfig& config, |
| 33 QuicSession* session, |
| 34 QuicCryptoClientConfig* crypto_config, |
| 35 HandshakeMode handshake_mode); |
| 22 virtual ~MockCryptoClientStream(); | 36 virtual ~MockCryptoClientStream(); |
| 23 | 37 |
| 24 // CryptoFramerVisitorInterface implementation. | 38 // CryptoFramerVisitorInterface implementation. |
| 25 virtual void OnHandshakeMessage( | 39 virtual void OnHandshakeMessage( |
| 26 const CryptoHandshakeMessage& message) OVERRIDE; | 40 const CryptoHandshakeMessage& message) OVERRIDE; |
| 27 | 41 |
| 28 // QuicCryptoClientStream implementation. | 42 // QuicCryptoClientStream implementation. |
| 29 virtual bool CryptoConnect() OVERRIDE; | 43 virtual bool CryptoConnect() OVERRIDE; |
| 44 |
| 45 HandshakeMode handshake_mode_; |
| 30 }; | 46 }; |
| 31 | 47 |
| 32 } // namespace net | 48 } // namespace net |
| 33 | 49 |
| 34 #endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ | 50 #endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ |
| OLD | NEW |