| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 | 10 |
| (...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 headers.SetHeader(GetStatusKey(), "200 OK"); | 1090 headers.SetHeader(GetStatusKey(), "200 OK"); |
| 1091 MaybeAddVersionHeader(&headers); | 1091 MaybeAddVersionHeader(&headers); |
| 1092 AppendToHeaderBlock(extra_headers, extra_header_count, | 1092 AppendToHeaderBlock(extra_headers, extra_header_count, |
| 1093 headers.mutable_header_block()); | 1093 headers.mutable_header_block()); |
| 1094 return CreateFramer(false)->SerializeFrame(headers); | 1094 return CreateFramer(false)->SerializeFrame(headers); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, | 1097 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
| 1098 const char* const headers[], | 1098 const char* const headers[], |
| 1099 int header_count) { | 1099 int header_count) { |
| 1100 return ConstructSpdyHeaderFrame(stream_id, headers, header_count, false); |
| 1101 } |
| 1102 |
| 1103 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
| 1104 const char* const headers[], |
| 1105 int header_count, |
| 1106 bool fin) { |
| 1100 SpdyHeadersIR spdy_headers(stream_id); | 1107 SpdyHeadersIR spdy_headers(stream_id); |
| 1108 spdy_headers.set_fin(fin); |
| 1101 AppendToHeaderBlock(headers, header_count, | 1109 AppendToHeaderBlock(headers, header_count, |
| 1102 spdy_headers.mutable_header_block()); | 1110 spdy_headers.mutable_header_block()); |
| 1103 return CreateFramer(false)->SerializeFrame(spdy_headers); | 1111 return CreateFramer(false)->SerializeFrame(spdy_headers); |
| 1104 } | 1112 } |
| 1105 | 1113 |
| 1106 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, | 1114 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, |
| 1107 const SpdyHeaderBlock& block, | 1115 const SpdyHeaderBlock& block, |
| 1108 RequestPriority priority, | 1116 RequestPriority priority, |
| 1109 bool compressed, | 1117 bool compressed, |
| 1110 bool fin) { | 1118 bool fin) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 block[GetMethodKey()] = "POST"; | 1223 block[GetMethodKey()] = "POST"; |
| 1216 AddUrlToHeaderBlock(default_url_.spec(), &block); | 1224 AddUrlToHeaderBlock(default_url_.spec(), &block); |
| 1217 AppendToHeaderBlock(extra_headers, extra_header_count, &block); | 1225 AppendToHeaderBlock(extra_headers, extra_header_count, &block); |
| 1218 return ConstructSpdySyn(1, block, LOWEST, false, false); | 1226 return ConstructSpdySyn(1, block, LOWEST, false, false); |
| 1219 } | 1227 } |
| 1220 | 1228 |
| 1221 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( | 1229 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( |
| 1222 const char* const extra_headers[], | 1230 const char* const extra_headers[], |
| 1223 int extra_header_count) { | 1231 int extra_header_count) { |
| 1224 // TODO(jgraettinger): Remove this method. | 1232 // TODO(jgraettinger): Remove this method. |
| 1225 return ConstructSpdyGetSynReply(NULL, 0, 1); | 1233 return ConstructSpdyGetSynReply(extra_headers, extra_header_count, 1); |
| 1226 } | 1234 } |
| 1227 | 1235 |
| 1228 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { | 1236 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { |
| 1229 SpdyFramer framer(spdy_version_); | 1237 SpdyFramer framer(spdy_version_); |
| 1230 SpdyDataIR data_ir(stream_id, | 1238 SpdyDataIR data_ir(stream_id, |
| 1231 base::StringPiece(kUploadData, kUploadDataSize)); | 1239 base::StringPiece(kUploadData, kUploadDataSize)); |
| 1232 data_ir.set_fin(fin); | 1240 data_ir.set_fin(fin); |
| 1233 return framer.SerializeData(data_ir); | 1241 return framer.SerializeData(data_ir); |
| 1234 } | 1242 } |
| 1235 | 1243 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 } | 1351 } |
| 1344 } | 1352 } |
| 1345 | 1353 |
| 1346 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1354 void SpdyTestUtil::SetPriority(RequestPriority priority, |
| 1347 SpdySynStreamIR* ir) const { | 1355 SpdySynStreamIR* ir) const { |
| 1348 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1356 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
| 1349 priority, spdy_version())); | 1357 priority, spdy_version())); |
| 1350 } | 1358 } |
| 1351 | 1359 |
| 1352 } // namespace net | 1360 } // namespace net |
| OLD | NEW |