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 3 // found in the LICENSE file. 4 5 #ifndef NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ 6 #define NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ 7 8 #include <string> 9 10 #include "net/quic/crypto/crypto_handshake.h" 11 #include "net/quic/quic_crypto_client_stream.h" 12 #include "net/quic/quic_session.h" 13 14 namespace net { 15 16 class MockCryptoClientStream : public QuicCryptoClientStream { 17 public: 18 // HandshakeMode enumerates the handshake mode MockCryptoClientStream should 19 // mock in CryptoConnect. 20 enum HandshakeMode { 21 // CONFIRM_HANDSHAKE indicates that CryptoConnect will immediately confirm 22 // the handshake and establish encryption. This behavior will never happen 23 // in the field, but is convenient for higher level tests. 24 CONFIRM_HANDSHAKE, 25 26 // ZERO_RTT indicates that CryptoConnect will establish encryption but will 27 // not confirm the handshake. 28 ZERO_RTT, 29 30 // COLD_START indicates that CryptoConnect will neither establish encryption 31 // nor confirm the handshake 32 COLD_START, 33 }; 34 35 MockCryptoClientStream( 36 const string& server_hostname, 37 QuicSession* session, 38 QuicCryptoClientConfig* crypto_config, 39 HandshakeMode handshake_mode); 40 virtual ~MockCryptoClientStream(); 41 42 // CryptoFramerVisitorInterface implementation. 43 virtual void OnHandshakeMessage( 44 const CryptoHandshakeMessage& message) OVERRIDE; 45 46 // QuicCryptoClientStream implementation. 47 virtual bool CryptoConnect() OVERRIDE; 48 49 HandshakeMode handshake_mode_; 50 51 private: 52 void SetConfigNegotiated(); 53 }; 54 55 } // namespace net 56 57 #endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ 58