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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, | 1217 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, |
1218 const char* data, | 1218 const char* data, |
1219 uint32 len, | 1219 uint32 len, |
1220 bool fin) { | 1220 bool fin) { |
1221 SpdyFramer framer(spdy_version_); | 1221 SpdyFramer framer(spdy_version_); |
1222 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); | 1222 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); |
1223 data_ir.set_fin(fin); | 1223 data_ir.set_fin(fin); |
1224 return framer.SerializeData(data_ir); | 1224 return framer.SerializeData(data_ir); |
1225 } | 1225 } |
1226 | 1226 |
| 1227 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, |
| 1228 const char* data, |
| 1229 uint32 len, |
| 1230 bool fin, |
| 1231 int padding_length) { |
| 1232 SpdyFramer framer(spdy_version_); |
| 1233 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); |
| 1234 data_ir.set_fin(fin); |
| 1235 data_ir.set_padding_len(padding_length); |
| 1236 return framer.SerializeData(data_ir); |
| 1237 } |
| 1238 |
1227 SpdyFrame* SpdyTestUtil::ConstructWrappedSpdyFrame( | 1239 SpdyFrame* SpdyTestUtil::ConstructWrappedSpdyFrame( |
1228 const scoped_ptr<SpdyFrame>& frame, | 1240 const scoped_ptr<SpdyFrame>& frame, |
1229 int stream_id) { | 1241 int stream_id) { |
1230 return ConstructSpdyBodyFrame(stream_id, frame->data(), | 1242 return ConstructSpdyBodyFrame(stream_id, frame->data(), |
1231 frame->size(), false); | 1243 frame->size(), false); |
1232 } | 1244 } |
1233 | 1245 |
1234 const SpdyHeaderInfo SpdyTestUtil::MakeSpdyHeader(SpdyFrameType type) { | 1246 const SpdyHeaderInfo SpdyTestUtil::MakeSpdyHeader(SpdyFrameType type) { |
1235 const SpdyHeaderInfo kHeader = { | 1247 const SpdyHeaderInfo kHeader = { |
1236 type, | 1248 type, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 } | 1327 } |
1316 } | 1328 } |
1317 | 1329 |
1318 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1330 void SpdyTestUtil::SetPriority(RequestPriority priority, |
1319 SpdySynStreamIR* ir) const { | 1331 SpdySynStreamIR* ir) const { |
1320 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1332 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
1321 priority, spdy_version())); | 1333 priority, spdy_version())); |
1322 } | 1334 } |
1323 | 1335 |
1324 } // namespace net | 1336 } // namespace net |
OLD | NEW |