| 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_random.h" | 14 #include "net/quic/test_tools/mock_random.h" |
| 14 #include "net/spdy/spdy_framer.h" | 15 #include "net/spdy/spdy_framer.h" |
| 15 #include "net/spdy/spdy_protocol.h" | 16 #include "net/spdy/spdy_protocol.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 namespace test { | 19 namespace test { |
| 19 | 20 |
| 20 class QuicTestPacketMaker { | 21 class QuicTestPacketMaker { |
| 21 public: | 22 public: |
| 22 QuicTestPacketMaker(QuicVersion version, QuicConnectionId connection_id); | 23 QuicTestPacketMaker(QuicVersion version, |
| 24 QuicConnectionId connection_id, |
| 25 MockClock* clock); |
| 23 ~QuicTestPacketMaker(); | 26 ~QuicTestPacketMaker(); |
| 24 | 27 |
| 25 scoped_ptr<QuicEncryptedPacket> MakeRstPacket( | 28 scoped_ptr<QuicEncryptedPacket> MakeRstPacket( |
| 26 QuicPacketSequenceNumber num, | 29 QuicPacketSequenceNumber num, |
| 27 bool include_version, | 30 bool include_version, |
| 28 QuicStreamId stream_id, | 31 QuicStreamId stream_id, |
| 29 QuicRstStreamErrorCode error_code); | 32 QuicRstStreamErrorCode error_code); |
| 30 scoped_ptr<QuicEncryptedPacket> MakeAckAndRstPacket( | 33 scoped_ptr<QuicEncryptedPacket> MakeAckAndRstPacket( |
| 31 QuicPacketSequenceNumber num, | 34 QuicPacketSequenceNumber num, |
| 32 bool include_version, | 35 bool include_version, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 private: | 73 private: |
| 71 scoped_ptr<QuicEncryptedPacket> MakePacket( | 74 scoped_ptr<QuicEncryptedPacket> MakePacket( |
| 72 const QuicPacketHeader& header, | 75 const QuicPacketHeader& header, |
| 73 const QuicFrame& frame); | 76 const QuicFrame& frame); |
| 74 | 77 |
| 75 void InitializeHeader(QuicPacketSequenceNumber sequence_number, | 78 void InitializeHeader(QuicPacketSequenceNumber sequence_number, |
| 76 bool should_include_version); | 79 bool should_include_version); |
| 77 | 80 |
| 78 QuicVersion version_; | 81 QuicVersion version_; |
| 79 QuicConnectionId connection_id_; | 82 QuicConnectionId connection_id_; |
| 83 MockClock* clock_; // Owned by QuicStreamFactory. |
| 80 SpdyFramer spdy_request_framer_; | 84 SpdyFramer spdy_request_framer_; |
| 81 SpdyFramer spdy_response_framer_; | 85 SpdyFramer spdy_response_framer_; |
| 82 MockRandom random_generator_; | 86 MockRandom random_generator_; |
| 83 QuicPacketHeader header_; | 87 QuicPacketHeader header_; |
| 84 | 88 |
| 85 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); | 89 DISALLOW_COPY_AND_ASSIGN(QuicTestPacketMaker); |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 } // namespace test | 92 } // namespace test |
| 89 } // namespace net | 93 } // namespace net |
| 90 | 94 |
| 91 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ | 95 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_PACKET_MAKER_H_ |
| OLD | NEW |