OLD | NEW |
| (Empty) |
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_FACTORY_H_ | |
6 #define NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_FACTORY_H_ | |
7 | |
8 #include <queue> | |
9 #include <string> | |
10 | |
11 #include "base/macros.h" | |
12 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | |
13 #include "net/quic/core/quic_crypto_client_stream_factory.h" | |
14 #include "net/quic/core/quic_server_id.h" | |
15 #include "net/quic/test_tools/mock_crypto_client_stream.h" | |
16 | |
17 namespace net { | |
18 | |
19 class QuicCryptoClientStream; | |
20 | |
21 class MockCryptoClientStreamFactory : public QuicCryptoClientStreamFactory { | |
22 public: | |
23 MockCryptoClientStreamFactory(); | |
24 ~MockCryptoClientStreamFactory() override; | |
25 | |
26 QuicCryptoClientStream* CreateQuicCryptoClientStream( | |
27 const QuicServerId& server_id, | |
28 QuicChromiumClientSession* session, | |
29 std::unique_ptr<ProofVerifyContext> proof_verify_context, | |
30 QuicCryptoClientConfig* crypto_config) override; | |
31 | |
32 void set_handshake_mode( | |
33 MockCryptoClientStream::HandshakeMode handshake_mode) { | |
34 handshake_mode_ = handshake_mode; | |
35 } | |
36 | |
37 // The caller keeps ownership of |proof_verify_details|. | |
38 void AddProofVerifyDetails( | |
39 const ProofVerifyDetailsChromium* proof_verify_details) { | |
40 proof_verify_details_queue_.push(proof_verify_details); | |
41 } | |
42 | |
43 MockCryptoClientStream* last_stream() const { return last_stream_; } | |
44 | |
45 // Sets initial config for new sessions. | |
46 void SetConfig(const QuicConfig& config); | |
47 | |
48 private: | |
49 MockCryptoClientStream::HandshakeMode handshake_mode_; | |
50 MockCryptoClientStream* last_stream_; | |
51 std::queue<const ProofVerifyDetailsChromium*> proof_verify_details_queue_; | |
52 std::unique_ptr<QuicConfig> config_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(MockCryptoClientStreamFactory); | |
55 }; | |
56 | |
57 } // namespace net | |
58 | |
59 #endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_FACTORY_H_ | |
OLD | NEW |