| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
| 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual ~SessionFactory() {} | 31 virtual ~SessionFactory() {} |
| 32 | 32 |
| 33 // Returns a new session owned by the caller. | 33 // Returns a new session owned by the caller. |
| 34 virtual QuicServerSessionBase* CreateSession( | 34 virtual QuicServerSessionBase* CreateSession( |
| 35 const QuicConfig& config, | 35 const QuicConfig& config, |
| 36 QuicConnection* connection, | 36 QuicConnection* connection, |
| 37 QuicSession::Visitor* visitor, | 37 QuicSession::Visitor* visitor, |
| 38 QuicCryptoServerStream::Helper* helper, | 38 QuicCryptoServerStream::Helper* helper, |
| 39 const QuicCryptoServerConfig* crypto_config, | 39 const QuicCryptoServerConfig* crypto_config, |
| 40 QuicCompressedCertsCache* compressed_certs_cache, | 40 QuicCompressedCertsCache* compressed_certs_cache, |
| 41 QuicInMemoryCache* in_memory_cache) = 0; | 41 QuicHttpResponseCache* response_cache) = 0; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // Factory for creating QuicSimpleServerStreams. | 44 // Factory for creating QuicSimpleServerStreams. |
| 45 class StreamFactory { | 45 class StreamFactory { |
| 46 public: | 46 public: |
| 47 virtual ~StreamFactory() {} | 47 virtual ~StreamFactory() {} |
| 48 | 48 |
| 49 // Returns a new stream owned by the caller. | 49 // Returns a new stream owned by the caller. |
| 50 virtual QuicSimpleServerStream* CreateStream( | 50 virtual QuicSimpleServerStream* CreateStream( |
| 51 QuicStreamId id, | 51 QuicStreamId id, |
| 52 QuicSpdySession* session, | 52 QuicSpdySession* session, |
| 53 QuicInMemoryCache* in_memory_cache) = 0; | 53 QuicHttpResponseCache* response_cache) = 0; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 class CryptoStreamFactory { | 56 class CryptoStreamFactory { |
| 57 public: | 57 public: |
| 58 virtual ~CryptoStreamFactory() {} | 58 virtual ~CryptoStreamFactory() {} |
| 59 | 59 |
| 60 // Returns a new QuicCryptoServerStreamBase owned by the caller | 60 // Returns a new QuicCryptoServerStreamBase owned by the caller |
| 61 virtual QuicCryptoServerStreamBase* CreateCryptoStream( | 61 virtual QuicCryptoServerStreamBase* CreateCryptoStream( |
| 62 const QuicCryptoServerConfig* crypto_config, | 62 const QuicCryptoServerConfig* crypto_config, |
| 63 QuicServerSessionBase* session) = 0; | 63 QuicServerSessionBase* session) = 0; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 QuicTestServer(std::unique_ptr<ProofSource> proof_source, | 66 QuicTestServer(std::unique_ptr<ProofSource> proof_source, |
| 67 QuicInMemoryCache* in_memory_cache); | 67 QuicHttpResponseCache* response_cache); |
| 68 QuicTestServer(std::unique_ptr<ProofSource> proof_source, | 68 QuicTestServer(std::unique_ptr<ProofSource> proof_source, |
| 69 const QuicConfig& config, | 69 const QuicConfig& config, |
| 70 const QuicVersionVector& supported_versions, | 70 const QuicVersionVector& supported_versions, |
| 71 QuicInMemoryCache* in_memory_cache); | 71 QuicHttpResponseCache* response_cache); |
| 72 | 72 |
| 73 // Create a custom dispatcher which creates custom sessions. | 73 // Create a custom dispatcher which creates custom sessions. |
| 74 QuicDispatcher* CreateQuicDispatcher() override; | 74 QuicDispatcher* CreateQuicDispatcher() override; |
| 75 | 75 |
| 76 // Sets a custom session factory, owned by the caller, for easy custom | 76 // Sets a custom session factory, owned by the caller, for easy custom |
| 77 // session logic. This is incompatible with setting a stream factory or a | 77 // session logic. This is incompatible with setting a stream factory or a |
| 78 // crypto stream factory. | 78 // crypto stream factory. |
| 79 void SetSessionFactory(SessionFactory* factory); | 79 void SetSessionFactory(SessionFactory* factory); |
| 80 | 80 |
| 81 // Sets a custom stream factory, owned by the caller, for easy custom | 81 // Sets a custom stream factory, owned by the caller, for easy custom |
| (...skipping 10 matching lines...) Expand all Loading... |
| 92 // Test session which sends a GOAWAY immedaitely on creation, before crypto | 92 // Test session which sends a GOAWAY immedaitely on creation, before crypto |
| 93 // credentials have even been established. | 93 // credentials have even been established. |
| 94 class ImmediateGoAwaySession : public QuicSimpleServerSession { | 94 class ImmediateGoAwaySession : public QuicSimpleServerSession { |
| 95 public: | 95 public: |
| 96 ImmediateGoAwaySession(const QuicConfig& config, | 96 ImmediateGoAwaySession(const QuicConfig& config, |
| 97 QuicConnection* connection, | 97 QuicConnection* connection, |
| 98 QuicSession::Visitor* visitor, | 98 QuicSession::Visitor* visitor, |
| 99 QuicCryptoServerStream::Helper* helper, | 99 QuicCryptoServerStream::Helper* helper, |
| 100 const QuicCryptoServerConfig* crypto_config, | 100 const QuicCryptoServerConfig* crypto_config, |
| 101 QuicCompressedCertsCache* compressed_certs_cache, | 101 QuicCompressedCertsCache* compressed_certs_cache, |
| 102 QuicInMemoryCache* in_memory_cache); | 102 QuicHttpResponseCache* response_cache); |
| 103 | 103 |
| 104 // Override to send GoAway. | 104 // Override to send GoAway. |
| 105 void OnStreamFrame(const QuicStreamFrame& frame) override; | 105 void OnStreamFrame(const QuicStreamFrame& frame) override; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace test | 108 } // namespace test |
| 109 | 109 |
| 110 | 110 |
| 111 } // namespace net | 111 } // namespace net |
| 112 | 112 |
| 113 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ | 113 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
| OLD | NEW |