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