| 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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 headers.SetHeader(GetStatusKey(), "200 OK"); | 1112 headers.SetHeader(GetStatusKey(), "200 OK"); |
| 1113 MaybeAddVersionHeader(&headers); | 1113 MaybeAddVersionHeader(&headers); |
| 1114 AppendToHeaderBlock(extra_headers, extra_header_count, | 1114 AppendToHeaderBlock(extra_headers, extra_header_count, |
| 1115 headers.mutable_header_block()); | 1115 headers.mutable_header_block()); |
| 1116 return CreateFramer(false)->SerializeFrame(headers); | 1116 return CreateFramer(false)->SerializeFrame(headers); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, | 1119 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
| 1120 const char* const headers[], | 1120 const char* const headers[], |
| 1121 int header_count) { | 1121 int header_count) { |
| 1122 return ConstructSpdyHeaderFrame(stream_id, headers, header_count, false); |
| 1123 } |
| 1124 |
| 1125 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
| 1126 const char* const headers[], |
| 1127 int header_count, |
| 1128 bool fin) { |
| 1122 SpdyHeadersIR spdy_headers(stream_id); | 1129 SpdyHeadersIR spdy_headers(stream_id); |
| 1130 spdy_headers.set_fin(fin); |
| 1123 AppendToHeaderBlock(headers, header_count, | 1131 AppendToHeaderBlock(headers, header_count, |
| 1124 spdy_headers.mutable_header_block()); | 1132 spdy_headers.mutable_header_block()); |
| 1125 return CreateFramer(false)->SerializeFrame(spdy_headers); | 1133 return CreateFramer(false)->SerializeFrame(spdy_headers); |
| 1126 } | 1134 } |
| 1127 | 1135 |
| 1128 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, | 1136 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, |
| 1129 const SpdyHeaderBlock& block, | 1137 const SpdyHeaderBlock& block, |
| 1130 RequestPriority priority, | 1138 RequestPriority priority, |
| 1131 bool compressed, | 1139 bool compressed, |
| 1132 bool fin) const { | 1140 bool fin) const { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 block[GetMethodKey()] = "POST"; | 1228 block[GetMethodKey()] = "POST"; |
| 1221 AddUrlToHeaderBlock(default_url_.spec(), &block); | 1229 AddUrlToHeaderBlock(default_url_.spec(), &block); |
| 1222 AppendToHeaderBlock(extra_headers, extra_header_count, &block); | 1230 AppendToHeaderBlock(extra_headers, extra_header_count, &block); |
| 1223 return ConstructSpdySyn(1, block, LOWEST, false, false); | 1231 return ConstructSpdySyn(1, block, LOWEST, false, false); |
| 1224 } | 1232 } |
| 1225 | 1233 |
| 1226 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( | 1234 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( |
| 1227 const char* const extra_headers[], | 1235 const char* const extra_headers[], |
| 1228 int extra_header_count) { | 1236 int extra_header_count) { |
| 1229 // TODO(jgraettinger): Remove this method. | 1237 // TODO(jgraettinger): Remove this method. |
| 1230 return ConstructSpdyGetSynReply(NULL, 0, 1); | 1238 return ConstructSpdyGetSynReply(extra_headers, extra_header_count, 1); |
| 1231 } | 1239 } |
| 1232 | 1240 |
| 1233 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { | 1241 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { |
| 1234 SpdyFramer framer(spdy_version_); | 1242 SpdyFramer framer(spdy_version_); |
| 1235 SpdyDataIR data_ir(stream_id, | 1243 SpdyDataIR data_ir(stream_id, |
| 1236 base::StringPiece(kUploadData, kUploadDataSize)); | 1244 base::StringPiece(kUploadData, kUploadDataSize)); |
| 1237 data_ir.set_fin(fin); | 1245 data_ir.set_fin(fin); |
| 1238 return framer.SerializeData(data_ir); | 1246 return framer.SerializeData(data_ir); |
| 1239 } | 1247 } |
| 1240 | 1248 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 } | 1359 } |
| 1352 } | 1360 } |
| 1353 | 1361 |
| 1354 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1362 void SpdyTestUtil::SetPriority(RequestPriority priority, |
| 1355 SpdySynStreamIR* ir) const { | 1363 SpdySynStreamIR* ir) const { |
| 1356 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1364 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
| 1357 priority, spdy_version())); | 1365 priority, spdy_version())); |
| 1358 } | 1366 } |
| 1359 | 1367 |
| 1360 } // namespace net | 1368 } // namespace net |
| OLD | NEW |