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

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

Issue 2544813002: Remove enum SpdyMajorVersion. (Closed)
Patch Set: Merge comment changes from 140661724. Created 4 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
« no previous file with comments | « net/spdy/spdy_stream_unittest.cc ('k') | net/spdy/spdy_test_utils.h » ('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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <utility> 10 #include <utility>
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 void SpdySessionPoolPeer::SetSessionMaxRecvWindowSize(size_t window) { 681 void SpdySessionPoolPeer::SetSessionMaxRecvWindowSize(size_t window) {
682 pool_->session_max_recv_window_size_ = window; 682 pool_->session_max_recv_window_size_ = window;
683 } 683 }
684 684
685 void SpdySessionPoolPeer::SetStreamInitialRecvWindowSize(size_t window) { 685 void SpdySessionPoolPeer::SetStreamInitialRecvWindowSize(size_t window) {
686 pool_->stream_max_recv_window_size_ = window; 686 pool_->stream_max_recv_window_size_ = window;
687 } 687 }
688 688
689 SpdyTestUtil::SpdyTestUtil() 689 SpdyTestUtil::SpdyTestUtil() : default_url_(GURL(kDefaultUrl)) {}
690 : headerless_spdy_framer_(HTTP2),
691 request_spdy_framer_(HTTP2),
692 response_spdy_framer_(HTTP2),
693 default_url_(GURL(kDefaultUrl)) {}
694 690
695 SpdyTestUtil::~SpdyTestUtil() {} 691 SpdyTestUtil::~SpdyTestUtil() {}
696 692
697 void SpdyTestUtil::AddUrlToHeaderBlock(base::StringPiece url, 693 void SpdyTestUtil::AddUrlToHeaderBlock(base::StringPiece url,
698 SpdyHeaderBlock* headers) const { 694 SpdyHeaderBlock* headers) const {
699 std::string scheme, host, path; 695 std::string scheme, host, path;
700 ParseUrl(url, &scheme, &host, &path); 696 ParseUrl(url, &scheme, &host, &path);
701 (*headers)[GetHostKey()] = host; 697 (*headers)[GetHostKey()] = host;
702 (*headers)[GetSchemeKey()] = scheme; 698 (*headers)[GetSchemeKey()] = scheme;
703 (*headers)[GetPathKey()] = path; 699 (*headers)[GetPathKey()] = path;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 1045
1050 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPostReply( 1046 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPostReply(
1051 const char* const extra_headers[], 1047 const char* const extra_headers[],
1052 int extra_header_count) { 1048 int extra_header_count) {
1053 // TODO(jgraettinger): Remove this method. 1049 // TODO(jgraettinger): Remove this method.
1054 return ConstructSpdyGetReply(extra_headers, extra_header_count, 1); 1050 return ConstructSpdyGetReply(extra_headers, extra_header_count, 1);
1055 } 1051 }
1056 1052
1057 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id, 1053 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id,
1058 bool fin) { 1054 bool fin) {
1059 SpdyFramer framer(HTTP2); 1055 SpdyFramer framer;
1060 SpdyDataIR data_ir(stream_id, 1056 SpdyDataIR data_ir(stream_id,
1061 base::StringPiece(kUploadData, kUploadDataSize)); 1057 base::StringPiece(kUploadData, kUploadDataSize));
1062 data_ir.set_fin(fin); 1058 data_ir.set_fin(fin);
1063 return SpdySerializedFrame(framer.SerializeData(data_ir)); 1059 return SpdySerializedFrame(framer.SerializeData(data_ir));
1064 } 1060 }
1065 1061
1066 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id, 1062 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id,
1067 const char* data, 1063 const char* data,
1068 uint32_t len, 1064 uint32_t len,
1069 bool fin) { 1065 bool fin) {
1070 SpdyFramer framer(HTTP2); 1066 SpdyFramer framer;
1071 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); 1067 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len));
1072 data_ir.set_fin(fin); 1068 data_ir.set_fin(fin);
1073 return SpdySerializedFrame(framer.SerializeData(data_ir)); 1069 return SpdySerializedFrame(framer.SerializeData(data_ir));
1074 } 1070 }
1075 1071
1076 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id, 1072 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id,
1077 const char* data, 1073 const char* data,
1078 uint32_t len, 1074 uint32_t len,
1079 bool fin, 1075 bool fin,
1080 int padding_length) { 1076 int padding_length) {
1081 SpdyFramer framer(HTTP2); 1077 SpdyFramer framer;
1082 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); 1078 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len));
1083 data_ir.set_fin(fin); 1079 data_ir.set_fin(fin);
1084 data_ir.set_padding_len(padding_length); 1080 data_ir.set_padding_len(padding_length);
1085 return SpdySerializedFrame(framer.SerializeData(data_ir)); 1081 return SpdySerializedFrame(framer.SerializeData(data_ir));
1086 } 1082 }
1087 1083
1088 SpdySerializedFrame SpdyTestUtil::ConstructWrappedSpdyFrame( 1084 SpdySerializedFrame SpdyTestUtil::ConstructWrappedSpdyFrame(
1089 const SpdySerializedFrame& frame, 1085 const SpdySerializedFrame& frame,
1090 int stream_id) { 1086 int stream_id) {
1091 return ConstructSpdyDataFrame(stream_id, frame.data(), frame.size(), false); 1087 return ConstructSpdyDataFrame(stream_id, frame.data(), frame.size(), false);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 headers[GetSchemeKey()] = scheme.c_str(); 1137 headers[GetSchemeKey()] = scheme.c_str();
1142 headers[GetPathKey()] = path.c_str(); 1138 headers[GetPathKey()] = path.c_str();
1143 if (content_length) { 1139 if (content_length) {
1144 std::string length_str = base::Int64ToString(*content_length); 1140 std::string length_str = base::Int64ToString(*content_length);
1145 headers["content-length"] = length_str; 1141 headers["content-length"] = length_str;
1146 } 1142 }
1147 return headers; 1143 return headers;
1148 } 1144 }
1149 1145
1150 } // namespace net 1146 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_unittest.cc ('k') | net/spdy/spdy_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698