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