| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Factory for creating QuicServerStreams. | 42 // Factory for creating QuicServerStreams. |
| 43 class StreamFactory { | 43 class StreamFactory { |
| 44 public: | 44 public: |
| 45 virtual ~StreamFactory() {} | 45 virtual ~StreamFactory() {} |
| 46 | 46 |
| 47 // Returns a new stream owned by the caller. | 47 // Returns a new stream owned by the caller. |
| 48 virtual QuicSpdyServerStream* CreateStream(QuicStreamId id, | 48 virtual QuicSpdyServerStream* CreateStream(QuicStreamId id, |
| 49 QuicSpdySession* session) = 0; | 49 QuicSpdySession* session) = 0; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class CryptoStreamFactory { |
| 53 public: |
| 54 virtual ~CryptoStreamFactory() {} |
| 55 |
| 56 // Returns a new QuicCryptoServerStreamBase owned by the caller |
| 57 virtual QuicCryptoServerStreamBase* CreateCryptoStream( |
| 58 const QuicCryptoServerConfig* crypto_config, |
| 59 QuicSpdySession* session) = 0; |
| 60 }; |
| 61 |
| 52 explicit QuicTestServer(ProofSource* proof_source); | 62 explicit QuicTestServer(ProofSource* proof_source); |
| 53 QuicTestServer(ProofSource* proof_source, | 63 QuicTestServer(ProofSource* proof_source, |
| 54 const QuicConfig& config, | 64 const QuicConfig& config, |
| 55 const QuicVersionVector& supported_versions); | 65 const QuicVersionVector& supported_versions); |
| 56 | 66 |
| 57 // Create a custom dispatcher which creates custom sessions. | 67 // Create a custom dispatcher which creates custom sessions. |
| 58 QuicDispatcher* CreateQuicDispatcher() override; | 68 QuicDispatcher* CreateQuicDispatcher() override; |
| 59 | 69 |
| 60 // Sets a custom session factory, owned by the caller, for easy custom | 70 // Sets a custom session factory, owned by the caller, for easy custom |
| 61 // session logic. This is incompatible with setting a stream factory. | 71 // session logic. This is incompatible with setting a stream factory or a |
| 72 // crypto stream factory. |
| 62 void SetSessionFactory(SessionFactory* factory); | 73 void SetSessionFactory(SessionFactory* factory); |
| 63 | 74 |
| 64 // Sets a custom stream factory, owned by the caller, for easy custom | 75 // Sets a custom stream factory, owned by the caller, for easy custom |
| 65 // stream logic. This is incompatible with setting a session factory. | 76 // stream logic. This is incompatible with setting a session factory. |
| 66 void SetSpdyStreamFactory(StreamFactory* factory); | 77 void SetSpdyStreamFactory(StreamFactory* factory); |
| 78 |
| 79 // Sets a custom crypto stream factory, owned by the caller, for easy custom |
| 80 // crypto logic. This is incompatible with setting a session factory. |
| 81 void SetCryptoStreamFactory(CryptoStreamFactory* factory); |
| 67 }; | 82 }; |
| 68 | 83 |
| 69 // Useful test sessions for the QuicTestServer. | 84 // Useful test sessions for the QuicTestServer. |
| 70 | 85 |
| 71 // Test session which sends a GOAWAY immedaitely on creation, before crypto | 86 // Test session which sends a GOAWAY immedaitely on creation, before crypto |
| 72 // credentials have even been established. | 87 // credentials have even been established. |
| 73 class ImmediateGoAwaySession : public QuicServerSession { | 88 class ImmediateGoAwaySession : public QuicServerSession { |
| 74 public: | 89 public: |
| 75 ImmediateGoAwaySession(const QuicConfig& config, | 90 ImmediateGoAwaySession(const QuicConfig& config, |
| 76 QuicConnection* connection, | 91 QuicConnection* connection, |
| 77 QuicServerSessionVisitor* visitor, | 92 QuicServerSessionVisitor* visitor, |
| 78 const QuicCryptoServerConfig* crypto_config); | 93 const QuicCryptoServerConfig* crypto_config); |
| 79 }; | 94 }; |
| 80 | 95 |
| 81 } // namespace test | 96 } // namespace test |
| 82 | 97 |
| 83 } // namespace tools | 98 } // namespace tools |
| 84 | 99 |
| 85 } // namespace net | 100 } // namespace net |
| 86 | 101 |
| 87 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ | 102 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
| OLD | NEW |