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 #include <utility> | 10 #include <utility> |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 // TODO(jgraettinger): Eliminate uses of this method in tests (prefer | 801 // TODO(jgraettinger): Eliminate uses of this method in tests (prefer |
802 // SpdyRstStreamIR). | 802 // SpdyRstStreamIR). |
803 SpdySerializedFrame SpdyTestUtil::ConstructSpdyRstStream( | 803 SpdySerializedFrame SpdyTestUtil::ConstructSpdyRstStream( |
804 SpdyStreamId stream_id, | 804 SpdyStreamId stream_id, |
805 SpdyRstStreamStatus status) { | 805 SpdyRstStreamStatus status) { |
806 SpdyRstStreamIR rst_ir(stream_id, status); | 806 SpdyRstStreamIR rst_ir(stream_id, status); |
807 return SpdySerializedFrame( | 807 return SpdySerializedFrame( |
808 headerless_spdy_framer_.SerializeRstStream(rst_ir)); | 808 headerless_spdy_framer_.SerializeRstStream(rst_ir)); |
809 } | 809 } |
810 | 810 |
| 811 // TODO(jgraettinger): Eliminate uses of this method in tests (prefer |
| 812 // SpdyPriorityIR). |
| 813 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPriority( |
| 814 SpdyStreamId stream_id, |
| 815 SpdyStreamId parent_stream_id, |
| 816 RequestPriority request_priority, |
| 817 bool exclusive) { |
| 818 int weight = Spdy3PriorityToHttp2Weight( |
| 819 ConvertRequestPriorityToSpdyPriority(request_priority)); |
| 820 SpdyPriorityIR ir(stream_id, parent_stream_id, weight, exclusive); |
| 821 return SpdySerializedFrame(headerless_spdy_framer_.SerializePriority(ir)); |
| 822 } |
| 823 |
811 SpdySerializedFrame SpdyTestUtil::ConstructSpdyGet( | 824 SpdySerializedFrame SpdyTestUtil::ConstructSpdyGet( |
812 const char* const url, | 825 const char* const url, |
813 SpdyStreamId stream_id, | 826 SpdyStreamId stream_id, |
814 RequestPriority request_priority) { | 827 RequestPriority request_priority) { |
815 SpdyHeaderBlock block(ConstructGetHeaderBlock(url)); | 828 SpdyHeaderBlock block(ConstructGetHeaderBlock(url)); |
816 return ConstructSpdyHeaders(stream_id, std::move(block), request_priority, | 829 return ConstructSpdyHeaders(stream_id, std::move(block), request_priority, |
817 true); | 830 true); |
818 } | 831 } |
819 | 832 |
820 SpdySerializedFrame SpdyTestUtil::ConstructSpdyGet( | 833 SpdySerializedFrame SpdyTestUtil::ConstructSpdyGet( |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 headers[GetSchemeKey()] = scheme.c_str(); | 1146 headers[GetSchemeKey()] = scheme.c_str(); |
1134 headers[GetPathKey()] = path.c_str(); | 1147 headers[GetPathKey()] = path.c_str(); |
1135 if (content_length) { | 1148 if (content_length) { |
1136 std::string length_str = base::Int64ToString(*content_length); | 1149 std::string length_str = base::Int64ToString(*content_length); |
1137 headers["content-length"] = length_str; | 1150 headers["content-length"] = length_str; |
1138 } | 1151 } |
1139 return headers; | 1152 return headers; |
1140 } | 1153 } |
1141 | 1154 |
1142 } // namespace net | 1155 } // namespace net |
OLD | NEW |