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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1093 headers.SetHeader(GetStatusKey(), "200 OK"); | 1093 headers.SetHeader(GetStatusKey(), "200 OK"); |
1094 MaybeAddVersionHeader(&headers); | 1094 MaybeAddVersionHeader(&headers); |
1095 AppendToHeaderBlock(extra_headers, extra_header_count, | 1095 AppendToHeaderBlock(extra_headers, extra_header_count, |
1096 headers.mutable_header_block()); | 1096 headers.mutable_header_block()); |
1097 return CreateFramer(false)->SerializeFrame(headers); | 1097 return CreateFramer(false)->SerializeFrame(headers); |
1098 } | 1098 } |
1099 | 1099 |
1100 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, | 1100 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
1101 const char* const headers[], | 1101 const char* const headers[], |
1102 int header_count) { | 1102 int header_count) { |
1103 return ConstructSpdyHeaderFrame(stream_id, headers, header_count, false); | |
1104 } | |
1105 | |
1106 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, | |
1107 const char* const headers[], | |
1108 int header_count, | |
1109 bool fin) { | |
1103 SpdyHeadersIR spdy_headers(stream_id); | 1110 SpdyHeadersIR spdy_headers(stream_id); |
1111 spdy_headers.set_fin(fin); | |
1104 AppendToHeaderBlock(headers, header_count, | 1112 AppendToHeaderBlock(headers, header_count, |
1105 spdy_headers.mutable_header_block()); | 1113 spdy_headers.mutable_header_block()); |
1106 return CreateFramer(false)->SerializeFrame(spdy_headers); | 1114 return CreateFramer(false)->SerializeFrame(spdy_headers); |
1107 } | 1115 } |
1108 | 1116 |
1109 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, | 1117 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, |
1110 const SpdyHeaderBlock& block, | 1118 const SpdyHeaderBlock& block, |
1111 RequestPriority priority, | 1119 RequestPriority priority, |
1112 bool compressed, | 1120 bool compressed, |
1113 bool fin) { | 1121 bool fin) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1218 block[GetMethodKey()] = "POST"; | 1226 block[GetMethodKey()] = "POST"; |
1219 AddUrlToHeaderBlock(default_url_.spec(), &block); | 1227 AddUrlToHeaderBlock(default_url_.spec(), &block); |
1220 AppendToHeaderBlock(extra_headers, extra_header_count, &block); | 1228 AppendToHeaderBlock(extra_headers, extra_header_count, &block); |
1221 return ConstructSpdySyn(1, block, LOWEST, false, false); | 1229 return ConstructSpdySyn(1, block, LOWEST, false, false); |
1222 } | 1230 } |
1223 | 1231 |
1224 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( | 1232 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( |
1225 const char* const extra_headers[], | 1233 const char* const extra_headers[], |
1226 int extra_header_count) { | 1234 int extra_header_count) { |
1227 // TODO(jgraettinger): Remove this method. | 1235 // TODO(jgraettinger): Remove this method. |
1228 return ConstructSpdyGetSynReply(NULL, 0, 1); | 1236 return ConstructSpdyGetSynReply(extra_headers, extra_header_count, 1); |
mef
2015/12/21 17:31:43
why this changed?
xunjieli
2015/12/21 22:01:22
I was trying to test setting extra headers on the
mef
2015/12/21 23:21:31
Acknowledged.
| |
1229 } | 1237 } |
1230 | 1238 |
1231 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { | 1239 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { |
1232 SpdyFramer framer(spdy_version_); | 1240 SpdyFramer framer(spdy_version_); |
1233 SpdyDataIR data_ir(stream_id, | 1241 SpdyDataIR data_ir(stream_id, |
1234 base::StringPiece(kUploadData, kUploadDataSize)); | 1242 base::StringPiece(kUploadData, kUploadDataSize)); |
1235 data_ir.set_fin(fin); | 1243 data_ir.set_fin(fin); |
1236 return framer.SerializeData(data_ir); | 1244 return framer.SerializeData(data_ir); |
1237 } | 1245 } |
1238 | 1246 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1346 } | 1354 } |
1347 } | 1355 } |
1348 | 1356 |
1349 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1357 void SpdyTestUtil::SetPriority(RequestPriority priority, |
1350 SpdySynStreamIR* ir) const { | 1358 SpdySynStreamIR* ir) const { |
1351 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1359 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
1352 priority, spdy_version())); | 1360 priority, spdy_version())); |
1353 } | 1361 } |
1354 | 1362 |
1355 } // namespace net | 1363 } // namespace net |
OLD | NEW |