Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: net/spdy/spdy_test_util_common.cc

Issue 358493002: Land recent SPDY changes (through 70021377) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on code-review-feedback updates. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | net/spdy/spdy_websocket_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 802 }
803 803
804 SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame( 804 SpdyFrame* SpdyTestUtil::ConstructSpdyControlFrame(
805 scoped_ptr<SpdyHeaderBlock> headers, 805 scoped_ptr<SpdyHeaderBlock> headers,
806 bool compressed, 806 bool compressed,
807 SpdyStreamId stream_id, 807 SpdyStreamId stream_id,
808 RequestPriority request_priority, 808 RequestPriority request_priority,
809 SpdyFrameType type, 809 SpdyFrameType type,
810 SpdyControlFlags flags, 810 SpdyControlFlags flags,
811 SpdyStreamId associated_stream_id) const { 811 SpdyStreamId associated_stream_id) const {
812 EXPECT_GE(type, FIRST_CONTROL_TYPE); 812 EXPECT_GE(type, DATA);
813 EXPECT_LE(type, LAST_CONTROL_TYPE); 813 EXPECT_LE(type, PRIORITY);
814 const SpdyHeaderInfo header_info = { 814 const SpdyHeaderInfo header_info = {
815 type, 815 type,
816 stream_id, 816 stream_id,
817 associated_stream_id, 817 associated_stream_id,
818 ConvertRequestPriorityToSpdyPriority(request_priority, spdy_version_), 818 ConvertRequestPriorityToSpdyPriority(request_priority, spdy_version_),
819 0, // credential slot 819 0, // credential slot
820 flags, 820 flags,
821 compressed, 821 compressed,
822 RST_STREAM_INVALID, // status 822 RST_STREAM_INVALID, // status
823 NULL, // data 823 NULL, // data
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 SpdyRstStreamStatus status) const { 932 SpdyRstStreamStatus status) const {
933 SpdyRstStreamIR rst_ir(stream_id, status, ""); 933 SpdyRstStreamIR rst_ir(stream_id, status, "");
934 return CreateFramer(false)->SerializeRstStream(rst_ir); 934 return CreateFramer(false)->SerializeRstStream(rst_ir);
935 } 935 }
936 936
937 SpdyFrame* SpdyTestUtil::ConstructSpdyGet( 937 SpdyFrame* SpdyTestUtil::ConstructSpdyGet(
938 const char* const url, 938 const char* const url,
939 bool compressed, 939 bool compressed,
940 SpdyStreamId stream_id, 940 SpdyStreamId stream_id,
941 RequestPriority request_priority) const { 941 RequestPriority request_priority) const {
942 const SpdyHeaderInfo header_info = { 942 scoped_ptr<SpdyHeaderBlock> block(ConstructGetHeaderBlock(url));
943 SYN_STREAM, 943 return ConstructSpdySyn(
944 stream_id, 944 stream_id, *block, request_priority, compressed, true);
945 0, // associated stream ID
946 ConvertRequestPriorityToSpdyPriority(request_priority, spdy_version_),
947 0, // credential slot
948 CONTROL_FLAG_FIN,
949 compressed,
950 RST_STREAM_INVALID, // status
951 NULL, // data
952 0, // length
953 DATA_FLAG_NONE
954 };
955 return ConstructSpdyFrame(header_info, ConstructGetHeaderBlock(url));
956 } 945 }
957 946
958 SpdyFrame* SpdyTestUtil::ConstructSpdyGet(const char* const extra_headers[], 947 SpdyFrame* SpdyTestUtil::ConstructSpdyGet(const char* const extra_headers[],
959 int extra_header_count, 948 int extra_header_count,
960 bool compressed, 949 bool compressed,
961 int stream_id, 950 int stream_id,
962 RequestPriority request_priority, 951 RequestPriority request_priority,
963 bool direct) const { 952 bool direct) const {
964 SpdySynStreamIR syn_stream(stream_id); 953 SpdyHeaderBlock block;
965 syn_stream.set_priority( 954 block[GetMethodKey()] = "GET";
966 ConvertRequestPriorityToSpdyPriority(request_priority, spdy_version_)); 955 block[GetPathKey()] =
967 syn_stream.set_fin(true); 956 (is_spdy2() && !direct) ? "http://www.google.com/" : "/";
968 syn_stream.SetHeader(GetMethodKey(), "GET"); 957 block[GetHostKey()] = "www.google.com";
969 syn_stream.SetHeader(GetHostKey(), "www.google.com"); 958 block[GetSchemeKey()] = "http";
970 syn_stream.SetHeader(GetSchemeKey(), "http"); 959 MaybeAddVersionHeader(&block);
971 syn_stream.SetHeader(GetPathKey(), (is_spdy2() && !direct) ? 960 AppendToHeaderBlock(extra_headers, extra_header_count, &block);
972 "http://www.google.com/" : "/"); 961 return ConstructSpdySyn(stream_id, block, request_priority, compressed, true);
973 MaybeAddVersionHeader(&syn_stream);
974 AppendToHeaderBlock(extra_headers, extra_header_count,
975 syn_stream.mutable_name_value_block());
976 return CreateFramer(compressed)->SerializeFrame(syn_stream);
977 } 962 }
978 963
979 SpdyFrame* SpdyTestUtil::ConstructSpdyConnect( 964 SpdyFrame* SpdyTestUtil::ConstructSpdyConnect(
980 const char* const extra_headers[], 965 const char* const extra_headers[],
981 int extra_header_count, 966 int extra_header_count,
982 int stream_id, 967 int stream_id,
983 RequestPriority priority) const { 968 RequestPriority priority) const {
984 SpdySynStreamIR syn_stream(stream_id); 969 SpdyHeaderBlock block;
985 syn_stream.set_priority( 970 block[GetMethodKey()] = "CONNECT";
986 ConvertRequestPriorityToSpdyPriority(priority, spdy_version_)); 971 block[GetPathKey()] = "www.google.com:443";
987 syn_stream.SetHeader(GetMethodKey(), "CONNECT"); 972 block[GetHostKey()] = "www.google.com";
988 syn_stream.SetHeader(GetPathKey(), "www.google.com:443"); 973 MaybeAddVersionHeader(&block);
989 syn_stream.SetHeader(GetHostKey(), "www.google.com"); 974 AppendToHeaderBlock(extra_headers, extra_header_count, &block);
990 MaybeAddVersionHeader(&syn_stream); 975 return ConstructSpdySyn(stream_id, block, priority, false, false);
991 AppendToHeaderBlock(extra_headers, extra_header_count,
992 syn_stream.mutable_name_value_block());
993 return CreateFramer(false)->SerializeFrame(syn_stream);
994 } 976 }
995 977
996 SpdyFrame* SpdyTestUtil::ConstructSpdyPush(const char* const extra_headers[], 978 SpdyFrame* SpdyTestUtil::ConstructSpdyPush(const char* const extra_headers[],
997 int extra_header_count, 979 int extra_header_count,
998 int stream_id, 980 int stream_id,
999 int associated_stream_id, 981 int associated_stream_id,
1000 const char* url) { 982 const char* url) {
1001 if (spdy_version() < SPDY4) { 983 if (spdy_version() < SPDY4) {
1002 SpdySynStreamIR syn_stream(stream_id); 984 SpdySynStreamIR syn_stream(stream_id);
1003 syn_stream.set_associated_to_stream_id(associated_stream_id); 985 syn_stream.set_associated_to_stream_id(associated_stream_id);
1004 syn_stream.SetHeader("hello", "bye"); 986 syn_stream.SetHeader("hello", "bye");
1005 syn_stream.SetHeader(GetStatusKey(), "200 OK"); 987 syn_stream.SetHeader(GetStatusKey(), "200 OK");
1006 syn_stream.SetHeader(GetVersionKey(), "HTTP/1.1"); 988 syn_stream.SetHeader(GetVersionKey(), "HTTP/1.1");
1007 AddUrlToHeaderBlock(url, syn_stream.mutable_name_value_block()); 989 AddUrlToHeaderBlock(url, syn_stream.mutable_name_value_block());
1008 AppendToHeaderBlock(extra_headers, 990 AppendToHeaderBlock(extra_headers,
1009 extra_header_count, 991 extra_header_count,
1010 syn_stream.mutable_name_value_block()); 992 syn_stream.mutable_name_value_block());
1011 return CreateFramer(false)->SerializeFrame(syn_stream); 993 return CreateFramer(false)->SerializeFrame(syn_stream);
1012 } else { 994 } else {
1013 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id); 995 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id);
1014 AddUrlToHeaderBlock(url, push_promise.mutable_name_value_block()); 996 AddUrlToHeaderBlock(url, push_promise.mutable_name_value_block());
1015 scoped_ptr<SpdyFrame> push_promise_frame( 997 scoped_ptr<SpdyFrame> push_promise_frame(
1016 CreateFramer(false)->SerializeFrame(push_promise)); 998 CreateFramer(false)->SerializeFrame(push_promise));
1017 999
1018 // Use SynStreamIR to create HEADERS+PRIORITY. Direct creation breaks 1000 SpdyHeadersIR headers(stream_id);
1019 // framer.
1020 SpdySynStreamIR headers(stream_id);
1021 SetPriority(LOWEST, &headers);
1022 headers.SetHeader("hello", "bye"); 1001 headers.SetHeader("hello", "bye");
1023 headers.SetHeader(GetStatusKey(), "200 OK"); 1002 headers.SetHeader(GetStatusKey(), "200 OK");
1024 AppendToHeaderBlock( 1003 AppendToHeaderBlock(
1025 extra_headers, extra_header_count, headers.mutable_name_value_block()); 1004 extra_headers, extra_header_count, headers.mutable_name_value_block());
1026 scoped_ptr<SpdyFrame> headers_frame( 1005 scoped_ptr<SpdyFrame> headers_frame(
1027 CreateFramer(false)->SerializeFrame(headers)); 1006 CreateFramer(false)->SerializeFrame(headers));
1028 1007
1029 int joint_data_size = push_promise_frame->size() + headers_frame->size(); 1008 int joint_data_size = push_promise_frame->size() + headers_frame->size();
1030 scoped_ptr<char[]> data(new char[joint_data_size]); 1009 scoped_ptr<char[]> data(new char[joint_data_size]);
1031 const SpdyFrame* frames[2] = { 1010 const SpdyFrame* frames[2] = {
(...skipping 24 matching lines...) Expand all
1056 AppendToHeaderBlock(extra_headers, 1035 AppendToHeaderBlock(extra_headers,
1057 extra_header_count, 1036 extra_header_count,
1058 syn_stream.mutable_name_value_block()); 1037 syn_stream.mutable_name_value_block());
1059 return CreateFramer(false)->SerializeFrame(syn_stream); 1038 return CreateFramer(false)->SerializeFrame(syn_stream);
1060 } else { 1039 } else {
1061 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id); 1040 SpdyPushPromiseIR push_promise(associated_stream_id, stream_id);
1062 AddUrlToHeaderBlock(url, push_promise.mutable_name_value_block()); 1041 AddUrlToHeaderBlock(url, push_promise.mutable_name_value_block());
1063 scoped_ptr<SpdyFrame> push_promise_frame( 1042 scoped_ptr<SpdyFrame> push_promise_frame(
1064 CreateFramer(false)->SerializeFrame(push_promise)); 1043 CreateFramer(false)->SerializeFrame(push_promise));
1065 1044
1066 // Use SynStreamIR to create HEADERS+PRIORITY. Direct creation breaks 1045 SpdyHeadersIR headers(stream_id);
1067 // framer.
1068 SpdySynStreamIR headers(stream_id);
1069 SetPriority(LOWEST, &headers);
1070 headers.SetHeader("hello", "bye"); 1046 headers.SetHeader("hello", "bye");
1071 headers.SetHeader(GetStatusKey(), status); 1047 headers.SetHeader(GetStatusKey(), status);
1072 headers.SetHeader("location", location); 1048 headers.SetHeader("location", location);
1073 AppendToHeaderBlock( 1049 AppendToHeaderBlock(
1074 extra_headers, extra_header_count, headers.mutable_name_value_block()); 1050 extra_headers, extra_header_count, headers.mutable_name_value_block());
1075 scoped_ptr<SpdyFrame> headers_frame( 1051 scoped_ptr<SpdyFrame> headers_frame(
1076 CreateFramer(false)->SerializeFrame(headers)); 1052 CreateFramer(false)->SerializeFrame(headers));
1077 1053
1078 int joint_data_size = push_promise_frame->size() + headers_frame->size(); 1054 int joint_data_size = push_promise_frame->size() + headers_frame->size();
1079 scoped_ptr<char[]> data(new char[joint_data_size]); 1055 scoped_ptr<char[]> data(new char[joint_data_size]);
(...skipping 29 matching lines...) Expand all
1109 const char* const extra_headers[], 1085 const char* const extra_headers[],
1110 int extra_header_count) { 1086 int extra_header_count) {
1111 SpdyHeadersIR headers(stream_id); 1087 SpdyHeadersIR headers(stream_id);
1112 headers.SetHeader(GetStatusKey(), "200 OK"); 1088 headers.SetHeader(GetStatusKey(), "200 OK");
1113 MaybeAddVersionHeader(&headers); 1089 MaybeAddVersionHeader(&headers);
1114 AppendToHeaderBlock(extra_headers, extra_header_count, 1090 AppendToHeaderBlock(extra_headers, extra_header_count,
1115 headers.mutable_name_value_block()); 1091 headers.mutable_name_value_block());
1116 return CreateFramer(false)->SerializeFrame(headers); 1092 return CreateFramer(false)->SerializeFrame(headers);
1117 } 1093 }
1118 1094
1095 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id,
1096 const SpdyHeaderBlock& block,
1097 RequestPriority priority,
1098 bool compressed,
1099 bool fin) const {
1100 if (protocol_ < kProtoSPDY4) {
1101 SpdySynStreamIR syn_stream(stream_id);
1102 syn_stream.set_name_value_block(block);
1103 syn_stream.set_priority(
1104 ConvertRequestPriorityToSpdyPriority(priority, spdy_version()));
1105 syn_stream.set_fin(fin);
1106 return CreateFramer(compressed)->SerializeFrame(syn_stream);
1107 } else {
1108 SpdyHeadersIR headers(stream_id);
1109 headers.set_name_value_block(block);
1110 headers.set_has_priority(true);
1111 headers.set_priority(
1112 ConvertRequestPriorityToSpdyPriority(priority, spdy_version()));
1113 headers.set_fin(fin);
1114 return CreateFramer(compressed)->SerializeFrame(headers);
1115 }
1116 }
1117
1118 SpdyFrame* SpdyTestUtil::ConstructSpdyReply(int stream_id,
1119 const SpdyHeaderBlock& headers) {
1120 if (protocol_ < kProtoSPDY4) {
1121 SpdySynReplyIR syn_reply(stream_id);
1122 syn_reply.set_name_value_block(headers);
1123 return CreateFramer(false)->SerializeFrame(syn_reply);
1124 } else {
1125 SpdyHeadersIR reply(stream_id);
1126 reply.set_name_value_block(headers);
1127 return CreateFramer(false)->SerializeFrame(reply);
1128 }
1129 }
1130
1119 SpdyFrame* SpdyTestUtil::ConstructSpdySynReplyError( 1131 SpdyFrame* SpdyTestUtil::ConstructSpdySynReplyError(
1120 const char* const status, 1132 const char* const status,
1121 const char* const* const extra_headers, 1133 const char* const* const extra_headers,
1122 int extra_header_count, 1134 int extra_header_count,
1123 int stream_id) { 1135 int stream_id) {
1124 SpdySynReplyIR syn_reply(stream_id); 1136 SpdyHeaderBlock block;
1125 syn_reply.SetHeader("hello", "bye"); 1137 block["hello"] = "bye";
1126 syn_reply.SetHeader(GetStatusKey(), status); 1138 block[GetStatusKey()] = status;
1127 MaybeAddVersionHeader(&syn_reply); 1139 MaybeAddVersionHeader(&block);
1128 AppendToHeaderBlock(extra_headers, extra_header_count, 1140 AppendToHeaderBlock(extra_headers, extra_header_count, &block);
1129 syn_reply.mutable_name_value_block()); 1141
1130 return CreateFramer(false)->SerializeFrame(syn_reply); 1142 return ConstructSpdyReply(stream_id, block);
1131 } 1143 }
1132 1144
1133 SpdyFrame* SpdyTestUtil::ConstructSpdyGetSynReplyRedirect(int stream_id) { 1145 SpdyFrame* SpdyTestUtil::ConstructSpdyGetSynReplyRedirect(int stream_id) {
1134 static const char* const kExtraHeaders[] = { 1146 static const char* const kExtraHeaders[] = {
1135 "location", "http://www.foo.com/index.php", 1147 "location", "http://www.foo.com/index.php",
1136 }; 1148 };
1137 return ConstructSpdySynReplyError("301 Moved Permanently", kExtraHeaders, 1149 return ConstructSpdySynReplyError("301 Moved Permanently", kExtraHeaders,
1138 arraysize(kExtraHeaders)/2, stream_id); 1150 arraysize(kExtraHeaders)/2, stream_id);
1139 } 1151 }
1140 1152
1141 SpdyFrame* SpdyTestUtil::ConstructSpdySynReplyError(int stream_id) { 1153 SpdyFrame* SpdyTestUtil::ConstructSpdySynReplyError(int stream_id) {
1142 return ConstructSpdySynReplyError("500 Internal Server Error", NULL, 0, 1); 1154 return ConstructSpdySynReplyError("500 Internal Server Error", NULL, 0, 1);
1143 } 1155 }
1144 1156
1145 SpdyFrame* SpdyTestUtil::ConstructSpdyGetSynReply( 1157 SpdyFrame* SpdyTestUtil::ConstructSpdyGetSynReply(
1146 const char* const extra_headers[], 1158 const char* const extra_headers[],
1147 int extra_header_count, 1159 int extra_header_count,
1148 int stream_id) { 1160 int stream_id) {
1149 SpdySynReplyIR syn_reply(stream_id); 1161 SpdyHeaderBlock block;
1150 syn_reply.SetHeader("hello", "bye"); 1162 block["hello"] = "bye";
1151 syn_reply.SetHeader(GetStatusKey(), "200"); 1163 block[GetStatusKey()] = "200";
1152 MaybeAddVersionHeader(&syn_reply); 1164 MaybeAddVersionHeader(&block);
1153 AppendToHeaderBlock(extra_headers, extra_header_count, 1165 AppendToHeaderBlock(extra_headers, extra_header_count, &block);
1154 syn_reply.mutable_name_value_block()); 1166
1155 return CreateFramer(false)->SerializeFrame(syn_reply); 1167 return ConstructSpdyReply(stream_id, block);
1156 } 1168 }
1157 1169
1158 SpdyFrame* SpdyTestUtil::ConstructSpdyPost(const char* url, 1170 SpdyFrame* SpdyTestUtil::ConstructSpdyPost(const char* url,
1159 SpdyStreamId stream_id, 1171 SpdyStreamId stream_id,
1160 int64 content_length, 1172 int64 content_length,
1161 RequestPriority priority, 1173 RequestPriority priority,
1162 const char* const extra_headers[], 1174 const char* const extra_headers[],
1163 int extra_header_count) { 1175 int extra_header_count) {
1164 const SpdyHeaderInfo kSynStartHeader = { 1176 scoped_ptr<SpdyHeaderBlock> block(
1165 SYN_STREAM, 1177 ConstructPostHeaderBlock(url, content_length));
1166 stream_id, 1178 AppendToHeaderBlock(extra_headers, extra_header_count, block.get());
1167 0, // Associated stream ID 1179 return ConstructSpdySyn(stream_id, *block, priority, false, false);
1168 ConvertRequestPriorityToSpdyPriority(priority, spdy_version_),
1169 kSpdyCredentialSlotUnused,
1170 CONTROL_FLAG_NONE,
1171 false, // Compressed
1172 RST_STREAM_INVALID,
1173 NULL, // Data
1174 0, // Length
1175 DATA_FLAG_NONE
1176 };
1177 return ConstructSpdyFrame(
1178 kSynStartHeader, ConstructPostHeaderBlock(url, content_length));
1179 } 1180 }
1180 1181
1181 SpdyFrame* SpdyTestUtil::ConstructChunkedSpdyPost( 1182 SpdyFrame* SpdyTestUtil::ConstructChunkedSpdyPost(
1182 const char* const extra_headers[], 1183 const char* const extra_headers[],
1183 int extra_header_count) { 1184 int extra_header_count) {
1184 SpdySynStreamIR syn_stream(1); 1185 SpdyHeaderBlock block;
1185 syn_stream.SetHeader(GetMethodKey(), "POST"); 1186 block[GetMethodKey()] = "POST";
1186 syn_stream.SetHeader(GetPathKey(), "/"); 1187 block[GetPathKey()] = "/";
1187 syn_stream.SetHeader(GetHostKey(), "www.google.com"); 1188 block[GetHostKey()] = "www.google.com";
1188 syn_stream.SetHeader(GetSchemeKey(), "http"); 1189 block[GetSchemeKey()] = "http";
1189 MaybeAddVersionHeader(&syn_stream); 1190 MaybeAddVersionHeader(&block);
1190 SetPriority(LOWEST, &syn_stream); 1191 AppendToHeaderBlock(extra_headers, extra_header_count, &block);
1191 AppendToHeaderBlock(extra_headers, extra_header_count, 1192 return ConstructSpdySyn(1, block, LOWEST, false, false);
1192 syn_stream.mutable_name_value_block());
1193 return CreateFramer(false)->SerializeFrame(syn_stream);
1194 } 1193 }
1195 1194
1196 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( 1195 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply(
1197 const char* const extra_headers[], 1196 const char* const extra_headers[],
1198 int extra_header_count) { 1197 int extra_header_count) {
1199 SpdySynReplyIR syn_reply(1); 1198 // TODO(jgraettinger): Remove this method.
1200 syn_reply.SetHeader("hello", "bye"); 1199 return ConstructSpdyGetSynReply(NULL, 0, 1);
1201 syn_reply.SetHeader(GetStatusKey(), "200");
1202 syn_reply.SetHeader(GetPathKey(), "/index.php");
1203 MaybeAddVersionHeader(&syn_reply);
1204 AppendToHeaderBlock(extra_headers, extra_header_count,
1205 syn_reply.mutable_name_value_block());
1206 return CreateFramer(false)->SerializeFrame(syn_reply);
1207 } 1200 }
1208 1201
1209 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { 1202 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) {
1210 SpdyFramer framer(spdy_version_); 1203 SpdyFramer framer(spdy_version_);
1211 SpdyDataIR data_ir(stream_id, 1204 SpdyDataIR data_ir(stream_id,
1212 base::StringPiece(kUploadData, kUploadDataSize)); 1205 base::StringPiece(kUploadData, kUploadDataSize));
1213 data_ir.set_fin(fin); 1206 data_ir.set_fin(fin);
1214 return framer.SerializeData(data_ir); 1207 return framer.SerializeData(data_ir);
1215 } 1208 }
1216 1209
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 return headers.Pass(); 1297 return headers.Pass();
1305 } 1298 }
1306 1299
1307 void SpdyTestUtil::MaybeAddVersionHeader( 1300 void SpdyTestUtil::MaybeAddVersionHeader(
1308 SpdyFrameWithNameValueBlockIR* frame_ir) const { 1301 SpdyFrameWithNameValueBlockIR* frame_ir) const {
1309 if (include_version_header()) { 1302 if (include_version_header()) {
1310 frame_ir->SetHeader(GetVersionKey(), "HTTP/1.1"); 1303 frame_ir->SetHeader(GetVersionKey(), "HTTP/1.1");
1311 } 1304 }
1312 } 1305 }
1313 1306
1307 void SpdyTestUtil::MaybeAddVersionHeader(SpdyHeaderBlock* block) const {
1308 if (include_version_header()) {
1309 (*block)[GetVersionKey()] = "HTTP/1.1";
1310 }
1311 }
1312
1314 void SpdyTestUtil::SetPriority(RequestPriority priority, 1313 void SpdyTestUtil::SetPriority(RequestPriority priority,
1315 SpdySynStreamIR* ir) const { 1314 SpdySynStreamIR* ir) const {
1316 ir->set_priority(ConvertRequestPriorityToSpdyPriority( 1315 ir->set_priority(ConvertRequestPriorityToSpdyPriority(
1317 priority, spdy_version())); 1316 priority, spdy_version()));
1318 } 1317 }
1319 1318
1320 } // namespace net 1319 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | net/spdy/spdy_websocket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698