OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
| 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
| 7 |
| 8 #include "net/tools/quic/quic_dispatcher.h" |
| 9 #include "net/tools/quic/quic_server.h" |
| 10 #include "net/tools/quic/quic_server_session.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 namespace tools { |
| 15 |
| 16 namespace test { |
| 17 |
| 18 // A test server which enables easy creation of custom QuicServerSessions |
| 19 // |
| 20 // Eventually this may be extended to allow custom QuicConnections etc. |
| 21 class QuicTestServer : public QuicServer { |
| 22 public: |
| 23 typedef std::function<QuicServerSession*(const QuicConfig& config, |
| 24 QuicConnection* connection, |
| 25 QuicServerSessionVisitor* visitor)> |
| 26 SessionCreationFunction; |
| 27 |
| 28 // Create a custom dispatcher which creates custom sessions. |
| 29 QuicDispatcher* CreateQuicDispatcher() override; |
| 30 |
| 31 void SetSessionCreator(const SessionCreationFunction& function); |
| 32 }; |
| 33 |
| 34 // Useful test sessions for the QuicTestServer. |
| 35 |
| 36 // Test session which sends a GOAWAY immedaitely on creation, before crypto |
| 37 // credentials have even been established. |
| 38 class ImmediateGoAwaySession : public QuicServerSession { |
| 39 public: |
| 40 ImmediateGoAwaySession(const QuicConfig& config, |
| 41 QuicConnection* connection, |
| 42 QuicServerSessionVisitor* visitor); |
| 43 }; |
| 44 |
| 45 } // namespace test |
| 46 |
| 47 } // namespace tools |
| 48 |
| 49 } // namespace net |
| 50 |
| 51 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_SERVER_H_ |
OLD | NEW |