OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/spdy/spdy_test_util_common.h" | 5 #include "net/spdy/spdy_test_util_common.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 headers.SetHeader(GetStatusKey(), "200 OK"); | 1100 headers.SetHeader(GetStatusKey(), "200 OK"); |
1101 MaybeAddVersionHeader(&headers); | 1101 MaybeAddVersionHeader(&headers); |
1102 AppendToHeaderBlock(extra_headers, extra_header_count, | 1102 AppendToHeaderBlock(extra_headers, extra_header_count, |
1103 headers.mutable_header_block()); | 1103 headers.mutable_header_block()); |
1104 return CreateFramer(false)->SerializeFrame(headers); | 1104 return CreateFramer(false)->SerializeFrame(headers); |
1105 } | 1105 } |
1106 | 1106 |
1107 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, | 1107 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
1108 const char* const headers[], | 1108 const char* const headers[], |
1109 int header_count) { | 1109 int header_count) { |
| 1110 return ConstructSpdyHeaderFrame(stream_id, headers, header_count, false); |
| 1111 } |
| 1112 |
| 1113 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
| 1114 const char* const headers[], |
| 1115 int header_count, |
| 1116 bool fin) { |
1110 SpdyHeadersIR spdy_headers(stream_id); | 1117 SpdyHeadersIR spdy_headers(stream_id); |
| 1118 spdy_headers.set_fin(fin); |
1111 AppendToHeaderBlock(headers, header_count, | 1119 AppendToHeaderBlock(headers, header_count, |
1112 spdy_headers.mutable_header_block()); | 1120 spdy_headers.mutable_header_block()); |
1113 return CreateFramer(false)->SerializeFrame(spdy_headers); | 1121 return CreateFramer(false)->SerializeFrame(spdy_headers); |
1114 } | 1122 } |
1115 | 1123 |
1116 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, | 1124 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, |
1117 const SpdyHeaderBlock& block, | 1125 const SpdyHeaderBlock& block, |
1118 RequestPriority priority, | 1126 RequestPriority priority, |
1119 bool compressed, | 1127 bool compressed, |
1120 bool fin) const { | 1128 bool fin) const { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 block[GetMethodKey()] = "POST"; | 1216 block[GetMethodKey()] = "POST"; |
1209 AddUrlToHeaderBlock(default_url_.spec(), &block); | 1217 AddUrlToHeaderBlock(default_url_.spec(), &block); |
1210 AppendToHeaderBlock(extra_headers, extra_header_count, &block); | 1218 AppendToHeaderBlock(extra_headers, extra_header_count, &block); |
1211 return ConstructSpdySyn(1, block, LOWEST, false, false); | 1219 return ConstructSpdySyn(1, block, LOWEST, false, false); |
1212 } | 1220 } |
1213 | 1221 |
1214 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( | 1222 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( |
1215 const char* const extra_headers[], | 1223 const char* const extra_headers[], |
1216 int extra_header_count) { | 1224 int extra_header_count) { |
1217 // TODO(jgraettinger): Remove this method. | 1225 // TODO(jgraettinger): Remove this method. |
1218 return ConstructSpdyGetSynReply(NULL, 0, 1); | 1226 return ConstructSpdyGetSynReply(extra_headers, extra_header_count, 1); |
1219 } | 1227 } |
1220 | 1228 |
1221 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { | 1229 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { |
1222 SpdyFramer framer(spdy_version_); | 1230 SpdyFramer framer(spdy_version_); |
1223 SpdyDataIR data_ir(stream_id, | 1231 SpdyDataIR data_ir(stream_id, |
1224 base::StringPiece(kUploadData, kUploadDataSize)); | 1232 base::StringPiece(kUploadData, kUploadDataSize)); |
1225 data_ir.set_fin(fin); | 1233 data_ir.set_fin(fin); |
1226 return framer.SerializeData(data_ir); | 1234 return framer.SerializeData(data_ir); |
1227 } | 1235 } |
1228 | 1236 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 } | 1347 } |
1340 } | 1348 } |
1341 | 1349 |
1342 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1350 void SpdyTestUtil::SetPriority(RequestPriority priority, |
1343 SpdySynStreamIR* ir) const { | 1351 SpdySynStreamIR* ir) const { |
1344 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1352 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
1345 priority, spdy_version())); | 1353 priority, spdy_version())); |
1346 } | 1354 } |
1347 | 1355 |
1348 } // namespace net | 1356 } // namespace net |
OLD | NEW |