| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Provides a simple interface for QUIC tests to create a variety of packets. | 5 // Provides a simple interface for QUIC tests to create a variety of packets. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ | 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ |
| 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ | 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/request_priority.h" | 11 #include "net/base/request_priority.h" |
| 12 #include "net/quic/quic_protocol.h" | 12 #include "net/quic/quic_protocol.h" |
| 13 #include "net/quic/quic_spdy_compressor.h" | |
| 14 #include "net/quic/test_tools/mock_random.h" | 13 #include "net/quic/test_tools/mock_random.h" |
| 15 #include "net/spdy/spdy_framer.h" | 14 #include "net/spdy/spdy_framer.h" |
| 16 #include "net/spdy/spdy_protocol.h" | 15 #include "net/spdy/spdy_protocol.h" |
| 17 | 16 |
| 18 namespace net { | 17 namespace net { |
| 19 namespace test { | 18 namespace test { |
| 20 | 19 |
| 21 class QuicTestPacketMaker { | 20 class QuicTestPacketMaker { |
| 22 public: | 21 public: |
| 23 QuicTestPacketMaker(QuicVersion version, QuicConnectionId connection_id); | 22 QuicTestPacketMaker(QuicVersion version, QuicConnectionId connection_id); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 scoped_ptr<QuicEncryptedPacket> MakeResponseHeadersPacket( | 58 scoped_ptr<QuicEncryptedPacket> MakeResponseHeadersPacket( |
| 60 QuicPacketSequenceNumber sequence_number, | 59 QuicPacketSequenceNumber sequence_number, |
| 61 QuicStreamId stream_id, | 60 QuicStreamId stream_id, |
| 62 bool should_include_version, | 61 bool should_include_version, |
| 63 bool fin, | 62 bool fin, |
| 64 const SpdyHeaderBlock& headers); | 63 const SpdyHeaderBlock& headers); |
| 65 | 64 |
| 66 SpdyHeaderBlock GetRequestHeaders(const std::string& method, | 65 SpdyHeaderBlock GetRequestHeaders(const std::string& method, |
| 67 const std::string& scheme, | 66 const std::string& scheme, |
| 68 const std::string& path); | 67 const std::string& path); |
| 69 std::string GetRequestString(const std::string& method, | |
| 70 const std::string& scheme, | |
| 71 const std::string& path); | |
| 72 SpdyHeaderBlock GetResponseHeaders(const std::string& status); | 68 SpdyHeaderBlock GetResponseHeaders(const std::string& status); |
| 73 std::string GetResponseString(const std::string& status, | |
| 74 const std::string& body); | |
| 75 | 69 |
| 76 private: | 70 private: |
| 77 scoped_ptr<QuicEncryptedPacket> MakePacket( | 71 scoped_ptr<QuicEncryptedPacket> MakePacket( |
| 78 const QuicPacketHeader& header, | 72 const QuicPacketHeader& header, |
| 79 const QuicFrame& frame); | 73 const QuicFrame& frame); |
| 80 | 74 |
| 81 void InitializeHeader(QuicPacketSequenceNumber sequence_number, | 75 void InitializeHeader(QuicPacketSequenceNumber sequence_number, |
| 82 bool should_include_version); | 76 bool should_include_version); |
| 83 | 77 |
| 84 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers); | |
| 85 | |
| 86 QuicVersion version_; | 78 QuicVersion version_; |
| 87 QuicConnectionId connection_id_; | 79 QuicConnectionId connection_id_; |
| 88 SpdyFramer spdy_request_framer_; | 80 SpdyFramer spdy_request_framer_; |
| 89 SpdyFramer spdy_response_framer_; | 81 SpdyFramer spdy_response_framer_; |
| 90 MockRandom random_generator_; | 82 MockRandom random_generator_; |
| 91 QuicPacketHeader header_; | 83 QuicPacketHeader header_; |
| 92 QuicSpdyCompressor compressor_; | |
| 93 | 84 |
| 94 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); | 85 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); |
| 95 }; | 86 }; |
| 96 | 87 |
| 97 } // namespace test | 88 } // namespace test |
| 98 } // namespace net | 89 } // namespace net |
| 99 | 90 |
| 100 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ | 91 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ |
| OLD | NEW |