| 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 "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | 11 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" |
| 12 #include "net/quic/core/crypto/crypto_handshake.h" | 12 #include "net/quic/core/crypto/crypto_handshake.h" |
| 13 #include "net/quic/core/crypto/crypto_protocol.h" | 13 #include "net/quic/core/crypto/crypto_protocol.h" |
| 14 #include "net/quic/core/quic_client_session_base.h" | 14 #include "net/quic/core/quic_client_session_base.h" |
| 15 #include "net/quic/core/quic_crypto_client_stream.h" | 15 #include "net/quic/core/quic_crypto_client_stream.h" |
| 16 #include "net/quic/core/quic_server_id.h" | 16 #include "net/quic/core/quic_server_id.h" |
| 17 #include "net/quic/core/quic_session.h" | 17 #include "net/quic/core/quic_session.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 class MockCryptoClientStream : public QuicCryptoClientStream { | 21 class MockCryptoClientStream : public QuicCryptoClientStream { |
| 22 public: | 22 public: |
| 23 // TODO(zhongyi): might consider move HandshakeMode up to |
| 24 // MockCryptoClientStreamFactory. |
| 23 // HandshakeMode enumerates the handshake mode MockCryptoClientStream should | 25 // HandshakeMode enumerates the handshake mode MockCryptoClientStream should |
| 24 // mock in CryptoConnect. | 26 // mock in CryptoConnect. |
| 25 enum HandshakeMode { | 27 enum HandshakeMode { |
| 26 // CONFIRM_HANDSHAKE indicates that CryptoConnect will immediately confirm | 28 // CONFIRM_HANDSHAKE indicates that CryptoConnect will immediately confirm |
| 27 // the handshake and establish encryption. This behavior will never happen | 29 // the handshake and establish encryption. This behavior will never happen |
| 28 // in the field, but is convenient for higher level tests. | 30 // in the field, but is convenient for higher level tests. |
| 29 CONFIRM_HANDSHAKE, | 31 CONFIRM_HANDSHAKE, |
| 30 | 32 |
| 31 // ZERO_RTT indicates that CryptoConnect will establish encryption but will | 33 // ZERO_RTT indicates that CryptoConnect will establish encryption but will |
| 32 // not confirm the handshake. | 34 // not confirm the handshake. |
| 33 ZERO_RTT, | 35 ZERO_RTT, |
| 34 | 36 |
| 35 // COLD_START indicates that CryptoConnect will neither establish encryption | 37 // COLD_START indicates that CryptoConnect will neither establish encryption |
| 36 // nor confirm the handshake | 38 // nor confirm the handshake |
| 37 COLD_START, | 39 COLD_START, |
| 40 |
| 41 // USE_DEFAULT_CRYPTO_STREAM indicates that MockCryptoClientStreamFactory |
| 42 // will create a QuicCryptoClientStream instead of a |
| 43 // MockCryptoClientStream. |
| 44 USE_DEFAULT_CRYPTO_STREAM, |
| 38 }; | 45 }; |
| 39 | 46 |
| 40 MockCryptoClientStream( | 47 MockCryptoClientStream( |
| 41 const QuicServerId& server_id, | 48 const QuicServerId& server_id, |
| 42 QuicClientSessionBase* session, | 49 QuicClientSessionBase* session, |
| 43 ProofVerifyContext* verify_context, | 50 ProofVerifyContext* verify_context, |
| 44 const QuicConfig& config, | 51 const QuicConfig& config, |
| 45 QuicCryptoClientConfig* crypto_config, | 52 QuicCryptoClientConfig* crypto_config, |
| 46 HandshakeMode handshake_mode, | 53 HandshakeMode handshake_mode, |
| 47 const ProofVerifyDetailsChromium* proof_verify_details_); | 54 const ProofVerifyDetailsChromium* proof_verify_details_); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 const QuicServerId server_id_; | 72 const QuicServerId server_id_; |
| 66 const ProofVerifyDetailsChromium* proof_verify_details_; | 73 const ProofVerifyDetailsChromium* proof_verify_details_; |
| 67 const QuicConfig config_; | 74 const QuicConfig config_; |
| 68 | 75 |
| 69 DISALLOW_COPY_AND_ASSIGN(MockCryptoClientStream); | 76 DISALLOW_COPY_AND_ASSIGN(MockCryptoClientStream); |
| 70 }; | 77 }; |
| 71 | 78 |
| 72 } // namespace net | 79 } // namespace net |
| 73 | 80 |
| 74 #endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ | 81 #endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_H_ |
| OLD | NEW |