| 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 #include "net/quic/test_tools/quic_test_packet_maker.h" | 5 #include "net/quic/test_tools/quic_test_packet_maker.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "net/quic/quic_framer.h" | 9 #include "net/quic/quic_framer.h" |
| 10 #include "net/quic/quic_http_utils.h" | 10 #include "net/quic/quic_http_utils.h" |
| 11 #include "net/quic/quic_utils.h" | 11 #include "net/quic/quic_utils.h" |
| 12 #include "net/quic/test_tools/quic_test_utils.h" | 12 #include "net/quic/test_tools/quic_test_utils.h" |
| 13 | 13 |
| 14 using std::make_pair; | 14 using std::make_pair; |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 namespace test { | 17 namespace test { |
| 18 | 18 |
| 19 QuicTestPacketMaker::QuicTestPacketMaker(QuicVersion version, | 19 QuicTestPacketMaker::QuicTestPacketMaker(QuicVersion version, |
| 20 QuicConnectionId connection_id, | 20 QuicConnectionId connection_id, |
| 21 MockClock* clock) | 21 MockClock* clock, |
| 22 const std::string& host) |
| 22 : version_(version), | 23 : version_(version), |
| 23 connection_id_(connection_id), | 24 connection_id_(connection_id), |
| 24 clock_(clock), | 25 clock_(clock), |
| 26 host_(host), |
| 25 spdy_request_framer_(SPDY4), | 27 spdy_request_framer_(SPDY4), |
| 26 spdy_response_framer_(SPDY4) { | 28 spdy_response_framer_(SPDY4) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 QuicTestPacketMaker::~QuicTestPacketMaker() { | 31 QuicTestPacketMaker::~QuicTestPacketMaker() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 scoped_ptr<QuicEncryptedPacket> QuicTestPacketMaker::MakeRstPacket( | 34 scoped_ptr<QuicEncryptedPacket> QuicTestPacketMaker::MakeRstPacket( |
| 33 QuicPacketSequenceNumber num, | 35 QuicPacketSequenceNumber num, |
| 34 bool include_version, | 36 bool include_version, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return MakePacket(header_, QuicFrame(&frame)); | 221 return MakePacket(header_, QuicFrame(&frame)); |
| 220 } | 222 } |
| 221 | 223 |
| 222 SpdyHeaderBlock QuicTestPacketMaker::GetRequestHeaders( | 224 SpdyHeaderBlock QuicTestPacketMaker::GetRequestHeaders( |
| 223 const std::string& method, | 225 const std::string& method, |
| 224 const std::string& scheme, | 226 const std::string& scheme, |
| 225 const std::string& path) { | 227 const std::string& path) { |
| 226 SpdyHeaderBlock headers; | 228 SpdyHeaderBlock headers; |
| 227 headers[":method"] = method; | 229 headers[":method"] = method; |
| 228 if (version_ <= QUIC_VERSION_24) { | 230 if (version_ <= QUIC_VERSION_24) { |
| 229 headers[":host"] = "www.google.com"; | 231 headers[":host"] = host_; |
| 230 } else { | 232 } else { |
| 231 headers[":authority"] = "www.google.com"; | 233 headers[":authority"] = host_; |
| 232 } | 234 } |
| 233 headers[":path"] = path; | 235 headers[":path"] = path; |
| 234 headers[":scheme"] = scheme; | 236 headers[":scheme"] = scheme; |
| 235 if (version_ <= QUIC_VERSION_24) { | 237 if (version_ <= QUIC_VERSION_24) { |
| 236 headers[":version"] = "HTTP/1.1"; | 238 headers[":version"] = "HTTP/1.1"; |
| 237 } | 239 } |
| 238 return headers; | 240 return headers; |
| 239 } | 241 } |
| 240 | 242 |
| 241 SpdyHeaderBlock QuicTestPacketMaker::GetResponseHeaders( | 243 SpdyHeaderBlock QuicTestPacketMaker::GetResponseHeaders( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 header_.public_header.version_flag = should_include_version; | 276 header_.public_header.version_flag = should_include_version; |
| 275 header_.public_header.sequence_number_length = PACKET_1BYTE_SEQUENCE_NUMBER; | 277 header_.public_header.sequence_number_length = PACKET_1BYTE_SEQUENCE_NUMBER; |
| 276 header_.packet_sequence_number = sequence_number; | 278 header_.packet_sequence_number = sequence_number; |
| 277 header_.fec_group = 0; | 279 header_.fec_group = 0; |
| 278 header_.entropy_flag = false; | 280 header_.entropy_flag = false; |
| 279 header_.fec_flag = false; | 281 header_.fec_flag = false; |
| 280 } | 282 } |
| 281 | 283 |
| 282 } // namespace test | 284 } // namespace test |
| 283 } // namespace net | 285 } // namespace net |
| OLD | NEW |