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

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

Issue 2566513004: This change removes SpdyFramer::set_enable_compression() in favor of a constructor parameter. (Closed)
Patch Set: 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_framer_test.cc ('k') | net/tools/quic/end_to_end_test.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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <utility> 10 #include <utility>
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 } 671 }
672 672
673 void SpdySessionPoolPeer::RemoveAliases(const SpdySessionKey& key) { 673 void SpdySessionPoolPeer::RemoveAliases(const SpdySessionKey& key) {
674 pool_->RemoveAliases(key); 674 pool_->RemoveAliases(key);
675 } 675 }
676 676
677 void SpdySessionPoolPeer::SetEnableSendingInitialData(bool enabled) { 677 void SpdySessionPoolPeer::SetEnableSendingInitialData(bool enabled) {
678 pool_->enable_sending_initial_data_ = enabled; 678 pool_->enable_sending_initial_data_ = enabled;
679 } 679 }
680 680
681 SpdyTestUtil::SpdyTestUtil() : default_url_(GURL(kDefaultUrl)) {} 681 SpdyTestUtil::SpdyTestUtil()
682 : headerless_spdy_framer_(SpdyFramer::ENABLE_COMPRESSION),
683 request_spdy_framer_(SpdyFramer::ENABLE_COMPRESSION),
684 response_spdy_framer_(SpdyFramer::ENABLE_COMPRESSION),
685 default_url_(GURL(kDefaultUrl)) {}
682 686
683 SpdyTestUtil::~SpdyTestUtil() {} 687 SpdyTestUtil::~SpdyTestUtil() {}
684 688
685 void SpdyTestUtil::AddUrlToHeaderBlock(base::StringPiece url, 689 void SpdyTestUtil::AddUrlToHeaderBlock(base::StringPiece url,
686 SpdyHeaderBlock* headers) const { 690 SpdyHeaderBlock* headers) const {
687 std::string scheme, host, path; 691 std::string scheme, host, path;
688 ParseUrl(url, &scheme, &host, &path); 692 ParseUrl(url, &scheme, &host, &path);
689 (*headers)[GetHostKey()] = host; 693 (*headers)[GetHostKey()] = host;
690 (*headers)[GetSchemeKey()] = scheme; 694 (*headers)[GetSchemeKey()] = scheme;
691 (*headers)[GetPathKey()] = path; 695 (*headers)[GetPathKey()] = path;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1041
1038 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPostReply( 1042 SpdySerializedFrame SpdyTestUtil::ConstructSpdyPostReply(
1039 const char* const extra_headers[], 1043 const char* const extra_headers[],
1040 int extra_header_count) { 1044 int extra_header_count) {
1041 // TODO(jgraettinger): Remove this method. 1045 // TODO(jgraettinger): Remove this method.
1042 return ConstructSpdyGetReply(extra_headers, extra_header_count, 1); 1046 return ConstructSpdyGetReply(extra_headers, extra_header_count, 1);
1043 } 1047 }
1044 1048
1045 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id, 1049 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id,
1046 bool fin) { 1050 bool fin) {
1047 SpdyFramer framer; 1051 SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
1048 SpdyDataIR data_ir(stream_id, 1052 SpdyDataIR data_ir(stream_id,
1049 base::StringPiece(kUploadData, kUploadDataSize)); 1053 base::StringPiece(kUploadData, kUploadDataSize));
1050 data_ir.set_fin(fin); 1054 data_ir.set_fin(fin);
1051 return SpdySerializedFrame(framer.SerializeData(data_ir)); 1055 return SpdySerializedFrame(framer.SerializeData(data_ir));
1052 } 1056 }
1053 1057
1054 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id, 1058 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id,
1055 const char* data, 1059 const char* data,
1056 uint32_t len, 1060 uint32_t len,
1057 bool fin) { 1061 bool fin) {
1058 SpdyFramer framer; 1062 SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
1059 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); 1063 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len));
1060 data_ir.set_fin(fin); 1064 data_ir.set_fin(fin);
1061 return SpdySerializedFrame(framer.SerializeData(data_ir)); 1065 return SpdySerializedFrame(framer.SerializeData(data_ir));
1062 } 1066 }
1063 1067
1064 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id, 1068 SpdySerializedFrame SpdyTestUtil::ConstructSpdyDataFrame(int stream_id,
1065 const char* data, 1069 const char* data,
1066 uint32_t len, 1070 uint32_t len,
1067 bool fin, 1071 bool fin,
1068 int padding_length) { 1072 int padding_length) {
1069 SpdyFramer framer; 1073 SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
1070 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len)); 1074 SpdyDataIR data_ir(stream_id, base::StringPiece(data, len));
1071 data_ir.set_fin(fin); 1075 data_ir.set_fin(fin);
1072 data_ir.set_padding_len(padding_length); 1076 data_ir.set_padding_len(padding_length);
1073 return SpdySerializedFrame(framer.SerializeData(data_ir)); 1077 return SpdySerializedFrame(framer.SerializeData(data_ir));
1074 } 1078 }
1075 1079
1076 SpdySerializedFrame SpdyTestUtil::ConstructWrappedSpdyFrame( 1080 SpdySerializedFrame SpdyTestUtil::ConstructWrappedSpdyFrame(
1077 const SpdySerializedFrame& frame, 1081 const SpdySerializedFrame& frame,
1078 int stream_id) { 1082 int stream_id) {
1079 return ConstructSpdyDataFrame(stream_id, frame.data(), frame.size(), false); 1083 return ConstructSpdyDataFrame(stream_id, frame.data(), frame.size(), false);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 headers[GetSchemeKey()] = scheme.c_str(); 1133 headers[GetSchemeKey()] = scheme.c_str();
1130 headers[GetPathKey()] = path.c_str(); 1134 headers[GetPathKey()] = path.c_str();
1131 if (content_length) { 1135 if (content_length) {
1132 std::string length_str = base::Int64ToString(*content_length); 1136 std::string length_str = base::Int64ToString(*content_length);
1133 headers["content-length"] = length_str; 1137 headers["content-length"] = length_str;
1134 } 1138 }
1135 return headers; 1139 return headers;
1136 } 1140 }
1137 1141
1138 } // namespace net 1142 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698