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

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

Issue 1326503003: Added a net::BidirectionalStream to expose a bidirectional streaming interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Misha's comments Created 5 years 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 10
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 headers.SetHeader(GetStatusKey(), "200 OK"); 1080 headers.SetHeader(GetStatusKey(), "200 OK");
1081 MaybeAddVersionHeader(&headers); 1081 MaybeAddVersionHeader(&headers);
1082 AppendToHeaderBlock(extra_headers, extra_header_count, 1082 AppendToHeaderBlock(extra_headers, extra_header_count,
1083 headers.mutable_header_block()); 1083 headers.mutable_header_block());
1084 return CreateFramer(false)->SerializeFrame(headers); 1084 return CreateFramer(false)->SerializeFrame(headers);
1085 } 1085 }
1086 1086
1087 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id, 1087 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id,
1088 const char* const headers[], 1088 const char* const headers[],
1089 int header_count) { 1089 int header_count) {
1090 return ConstructSpdyHeaderFrame(stream_id, headers, header_count, false);
1091 }
1092
1093 SpdyFrame* SpdyTestUtil::ConstructSpdyHeaderFrame(int stream_id,
1094 const char* const headers[],
1095 int header_count,
1096 bool fin) {
1090 SpdyHeadersIR spdy_headers(stream_id); 1097 SpdyHeadersIR spdy_headers(stream_id);
1098 spdy_headers.set_fin(fin);
1091 AppendToHeaderBlock(headers, header_count, 1099 AppendToHeaderBlock(headers, header_count,
1092 spdy_headers.mutable_header_block()); 1100 spdy_headers.mutable_header_block());
1093 return CreateFramer(false)->SerializeFrame(spdy_headers); 1101 return CreateFramer(false)->SerializeFrame(spdy_headers);
1094 } 1102 }
1095 1103
1096 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id, 1104 SpdyFrame* SpdyTestUtil::ConstructSpdySyn(int stream_id,
1097 const SpdyHeaderBlock& block, 1105 const SpdyHeaderBlock& block,
1098 RequestPriority priority, 1106 RequestPriority priority,
1099 bool compressed, 1107 bool compressed,
1100 bool fin) { 1108 bool fin) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 block[GetMethodKey()] = "POST"; 1213 block[GetMethodKey()] = "POST";
1206 AddUrlToHeaderBlock(default_url_.spec(), &block); 1214 AddUrlToHeaderBlock(default_url_.spec(), &block);
1207 AppendToHeaderBlock(extra_headers, extra_header_count, &block); 1215 AppendToHeaderBlock(extra_headers, extra_header_count, &block);
1208 return ConstructSpdySyn(1, block, LOWEST, false, false); 1216 return ConstructSpdySyn(1, block, LOWEST, false, false);
1209 } 1217 }
1210 1218
1211 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply( 1219 SpdyFrame* SpdyTestUtil::ConstructSpdyPostSynReply(
1212 const char* const extra_headers[], 1220 const char* const extra_headers[],
1213 int extra_header_count) { 1221 int extra_header_count) {
1214 // TODO(jgraettinger): Remove this method. 1222 // TODO(jgraettinger): Remove this method.
1215 return ConstructSpdyGetSynReply(NULL, 0, 1); 1223 return ConstructSpdyGetSynReply(extra_headers, extra_header_count, 1);
1216 } 1224 }
1217 1225
1218 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) { 1226 SpdyFrame* SpdyTestUtil::ConstructSpdyBodyFrame(int stream_id, bool fin) {
1219 SpdyFramer framer(spdy_version_); 1227 SpdyFramer framer(spdy_version_);
1220 SpdyDataIR data_ir(stream_id, 1228 SpdyDataIR data_ir(stream_id,
1221 base::StringPiece(kUploadData, kUploadDataSize)); 1229 base::StringPiece(kUploadData, kUploadDataSize));
1222 data_ir.set_fin(fin); 1230 data_ir.set_fin(fin);
1223 return framer.SerializeData(data_ir); 1231 return framer.SerializeData(data_ir);
1224 } 1232 }
1225 1233
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 } 1341 }
1334 } 1342 }
1335 1343
1336 void SpdyTestUtil::SetPriority(RequestPriority priority, 1344 void SpdyTestUtil::SetPriority(RequestPriority priority,
1337 SpdySynStreamIR* ir) const { 1345 SpdySynStreamIR* ir) const {
1338 ir->set_priority(ConvertRequestPriorityToSpdyPriority( 1346 ir->set_priority(ConvertRequestPriorityToSpdyPriority(
1339 priority, spdy_version())); 1347 priority, spdy_version()));
1340 } 1348 }
1341 1349
1342 } // namespace net 1350 } // namespace net
OLDNEW
« net/http/http_stream_factory_impl.cc ('K') | « net/spdy/spdy_test_util_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698