| 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" | 13 #include "net/quic/quic_spdy_compressor.h" |
| 14 #include "net/quic/test_tools/mock_random.h" | 14 #include "net/quic/test_tools/mock_random.h" |
| 15 #include "net/spdy/spdy_framer.h" | 15 #include "net/spdy/spdy_framer.h" |
| 16 #include "net/spdy/spdy_protocol.h" | 16 #include "net/spdy/spdy_protocol.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 class QuicTestPacketMaker { | 21 class QuicTestPacketMaker { |
| 22 public: | 22 public: |
| 23 QuicTestPacketMaker(QuicVersion version, QuicGuid guid); | 23 QuicTestPacketMaker(QuicVersion version, QuicConnectionId connection_id); |
| 24 ~QuicTestPacketMaker(); | 24 ~QuicTestPacketMaker(); |
| 25 | 25 |
| 26 scoped_ptr<QuicEncryptedPacket> MakeRstPacket( | 26 scoped_ptr<QuicEncryptedPacket> MakeRstPacket( |
| 27 QuicPacketSequenceNumber num, | 27 QuicPacketSequenceNumber num, |
| 28 bool include_version, | 28 bool include_version, |
| 29 QuicStreamId stream_id, | 29 QuicStreamId stream_id, |
| 30 QuicRstStreamErrorCode error_code); | 30 QuicRstStreamErrorCode error_code); |
| 31 scoped_ptr<QuicEncryptedPacket> MakeAckAndRstPacket( | 31 scoped_ptr<QuicEncryptedPacket> MakeAckAndRstPacket( |
| 32 QuicPacketSequenceNumber num, | 32 QuicPacketSequenceNumber num, |
| 33 bool include_version, | 33 bool include_version, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 scoped_ptr<QuicEncryptedPacket> MakePacket( | 77 scoped_ptr<QuicEncryptedPacket> MakePacket( |
| 78 const QuicPacketHeader& header, | 78 const QuicPacketHeader& header, |
| 79 const QuicFrame& frame); | 79 const QuicFrame& frame); |
| 80 | 80 |
| 81 void InitializeHeader(QuicPacketSequenceNumber sequence_number, | 81 void InitializeHeader(QuicPacketSequenceNumber sequence_number, |
| 82 bool should_include_version); | 82 bool should_include_version); |
| 83 | 83 |
| 84 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers); | 84 std::string SerializeHeaderBlock(const SpdyHeaderBlock& headers); |
| 85 | 85 |
| 86 QuicVersion version_; | 86 QuicVersion version_; |
| 87 QuicGuid guid_; | 87 QuicConnectionId connection_id_; |
| 88 SpdyFramer spdy_request_framer_; | 88 SpdyFramer spdy_request_framer_; |
| 89 SpdyFramer spdy_response_framer_; | 89 SpdyFramer spdy_response_framer_; |
| 90 MockRandom random_generator_; | 90 MockRandom random_generator_; |
| 91 QuicPacketHeader header_; | 91 QuicPacketHeader header_; |
| 92 QuicSpdyCompressor compressor_; | 92 QuicSpdyCompressor compressor_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); | 94 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace test | 97 } // namespace test |
| 98 } // namespace net | 98 } // namespace net |
| 99 | 99 |
| 100 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ | 100 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ |
| OLD | NEW |