| 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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 const char* const extra_headers[], | 1098 const char* const extra_headers[], |
| 1099 int extra_header_count) { | 1099 int extra_header_count) { |
| 1100 SpdyHeadersIR headers(stream_id); | 1100 SpdyHeadersIR headers(stream_id); |
| 1101 headers.SetHeader(GetStatusKey(), "200 OK"); | 1101 headers.SetHeader(GetStatusKey(), "200 OK"); |
| 1102 MaybeAddVersionHeader(&headers); | 1102 MaybeAddVersionHeader(&headers); |
| 1103 AppendToHeaderBlock(extra_headers, extra_header_count, | 1103 AppendToHeaderBlock(extra_headers, extra_header_count, |
| 1104 headers.mutable_header_block()); | 1104 headers.mutable_header_block()); |
| 1105 return CreateFramer(false)->SerializeFrame(headers); | 1105 return CreateFramer(false)->SerializeFrame(headers); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, |
| 1109 const char* const headers[], |
| 1110 int header_count) { |
| 1111 SpdyHeadersIR spdy_headers(stream_id); |
| 1112 AppendToHeaderBlock(headers, header_count, |
| 1113 spdy_headers.mutable_header_block()); |
| 1114 return CreateFramer(false)->SerializeFrame(spdy_headers); |
| 1115 } |
| 1116 |
| 1108 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, | 1117 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, |
| 1109 const SpdyHeaderBlock& block, | 1118 const SpdyHeaderBlock& block, |
| 1110 RequestPriority priority, | 1119 RequestPriority priority, |
| 1111 bool compressed, | 1120 bool compressed, |
| 1112 bool fin) const { | 1121 bool fin) const { |
| 1113 if (protocol_ < kProtoHTTP2MinimumVersion) { | 1122 if (protocol_ < kProtoHTTP2MinimumVersion) { |
| 1114 SpdySynStreamIR syn_stream(stream_id); | 1123 SpdySynStreamIR syn_stream(stream_id); |
| 1115 syn_stream.set_header_block(block); | 1124 syn_stream.set_header_block(block); |
| 1116 syn_stream.set_priority( | 1125 syn_stream.set_priority( |
| 1117 ConvertRequestPriorityToSpdyPriority(priority, spdy_version())); | 1126 ConvertRequestPriorityToSpdyPriority(priority, spdy_version())); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 } | 1340 } |
| 1332 } | 1341 } |
| 1333 | 1342 |
| 1334 void SpdyTestUtil::SetPriority(RequestPriority priority, | 1343 void SpdyTestUtil::SetPriority(RequestPriority priority, |
| 1335 SpdySynStreamIR* ir) const { | 1344 SpdySynStreamIR* ir) const { |
| 1336 ir->set_priority(ConvertRequestPriorityToSpdyPriority( | 1345 ir->set_priority(ConvertRequestPriorityToSpdyPriority( |
| 1337 priority, spdy_version())); | 1346 priority, spdy_version())); |
| 1338 } | 1347 } |
| 1339 | 1348 |
| 1340 } // namespace net | 1349 } // namespace net |
| OLD | NEW |