| 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/test_tools/mock_clock.h" | 13 #include "net/quic/test_tools/mock_clock.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, | 23 QuicTestPacketMaker(QuicVersion version, |
| 24 QuicConnectionId connection_id, | 24 QuicConnectionId connection_id, |
| 25 MockClock* clock); | 25 MockClock* clock, |
| 26 const std::string& host); |
| 26 ~QuicTestPacketMaker(); | 27 ~QuicTestPacketMaker(); |
| 27 | 28 |
| 28 scoped_ptr<QuicEncryptedPacket> MakeRstPacket( | 29 scoped_ptr<QuicEncryptedPacket> MakeRstPacket( |
| 29 QuicPacketSequenceNumber num, | 30 QuicPacketSequenceNumber num, |
| 30 bool include_version, | 31 bool include_version, |
| 31 QuicStreamId stream_id, | 32 QuicStreamId stream_id, |
| 32 QuicRstStreamErrorCode error_code); | 33 QuicRstStreamErrorCode error_code); |
| 33 scoped_ptr<QuicEncryptedPacket> MakeAckAndRstPacket( | 34 scoped_ptr<QuicEncryptedPacket> MakeAckAndRstPacket( |
| 34 QuicPacketSequenceNumber num, | 35 QuicPacketSequenceNumber num, |
| 35 bool include_version, | 36 bool include_version, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 scoped_ptr<QuicEncryptedPacket> MakePacket( | 76 scoped_ptr<QuicEncryptedPacket> MakePacket( |
| 76 const QuicPacketHeader& header, | 77 const QuicPacketHeader& header, |
| 77 const QuicFrame& frame); | 78 const QuicFrame& frame); |
| 78 | 79 |
| 79 void InitializeHeader(QuicPacketSequenceNumber sequence_number, | 80 void InitializeHeader(QuicPacketSequenceNumber sequence_number, |
| 80 bool should_include_version); | 81 bool should_include_version); |
| 81 | 82 |
| 82 QuicVersion version_; | 83 QuicVersion version_; |
| 83 QuicConnectionId connection_id_; | 84 QuicConnectionId connection_id_; |
| 84 MockClock* clock_; // Owned by QuicStreamFactory. | 85 MockClock* clock_; // Owned by QuicStreamFactory. |
| 86 const std::string host_; |
| 85 SpdyFramer spdy_request_framer_; | 87 SpdyFramer spdy_request_framer_; |
| 86 SpdyFramer spdy_response_framer_; | 88 SpdyFramer spdy_response_framer_; |
| 87 MockRandom random_generator_; | 89 MockRandom random_generator_; |
| 88 QuicPacketHeader header_; | 90 QuicPacketHeader header_; |
| 89 | 91 |
| 90 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); | 92 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 } // namespace test | 95 } // namespace test |
| 94 } // namespace net | 96 } // namespace net |
| 95 | 97 |
| 96 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ | 98 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ |
| OLD | NEW |