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

Side by Side Diff: net/quic/quic_http_stream_test.cc

Issue 14718011: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/quic/quic_framer_test.cc ('k') | net/quic/quic_network_transaction_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/quic/quic_http_stream.h" 5 #include "net/quic/quic_http_stream.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 IoMode mode; 112 IoMode mode;
113 QuicEncryptedPacket* packet; 113 QuicEncryptedPacket* packet;
114 }; 114 };
115 115
116 QuicHttpStreamTest() 116 QuicHttpStreamTest()
117 : net_log_(BoundNetLog()), 117 : net_log_(BoundNetLog()),
118 use_closing_stream_(false), 118 use_closing_stream_(false),
119 read_buffer_(new IOBufferWithSize(4096)), 119 read_buffer_(new IOBufferWithSize(4096)),
120 guid_(2), 120 guid_(2),
121 framer_(kQuicVersion1, 121 framer_(kQuicVersion1, QuicTime::Zero(), false),
122 QuicDecrypter::Create(kNULL),
123 QuicEncrypter::Create(kNULL),
124 QuicTime::Zero(),
125 false),
126 creator_(guid_, &framer_, &random_, false) { 122 creator_(guid_, &framer_, &random_, false) {
127 IPAddressNumber ip; 123 IPAddressNumber ip;
128 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); 124 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip));
129 peer_addr_ = IPEndPoint(ip, 443); 125 peer_addr_ = IPEndPoint(ip, 443);
130 self_addr_ = IPEndPoint(ip, 8435); 126 self_addr_ = IPEndPoint(ip, 8435);
131 } 127 }
132 128
133 ~QuicHttpStreamTest() { 129 ~QuicHttpStreamTest() {
134 for (size_t i = 0; i < writes_.size(); i++) { 130 for (size_t i = 0; i < writes_.size(); i++) {
135 delete writes_[i].packet; 131 delete writes_[i].packet;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 connection_ = new TestQuicConnection(guid_, peer_addr_, helper_); 175 connection_ = new TestQuicConnection(guid_, peer_addr_, helper_);
180 connection_->set_visitor(&visitor_); 176 connection_->set_visitor(&visitor_);
181 connection_->SetSendAlgorithm(send_algorithm_); 177 connection_->SetSendAlgorithm(send_algorithm_);
182 connection_->SetReceiveAlgorithm(receive_algorithm_); 178 connection_->SetReceiveAlgorithm(receive_algorithm_);
183 crypto_config_.SetDefaults(); 179 crypto_config_.SetDefaults();
184 session_.reset(new QuicClientSession(connection_, socket, NULL, 180 session_.reset(new QuicClientSession(connection_, socket, NULL,
185 &crypto_client_stream_factory_, 181 &crypto_client_stream_factory_,
186 "www.google.com", &crypto_config_, 182 "www.google.com", &crypto_config_,
187 NULL)); 183 NULL));
188 session_->GetCryptoStream()->CryptoConnect(); 184 session_->GetCryptoStream()->CryptoConnect();
189 EXPECT_TRUE(session_->IsCryptoHandshakeComplete()); 185 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
190 QuicReliableClientStream* stream = 186 QuicReliableClientStream* stream =
191 session_->CreateOutgoingReliableStream(); 187 session_->CreateOutgoingReliableStream();
192 stream_.reset(use_closing_stream_ ? 188 stream_.reset(use_closing_stream_ ?
193 new AutoClosingStream(stream) : 189 new AutoClosingStream(stream) :
194 new QuicHttpStream(stream)); 190 new QuicHttpStream(stream));
195 } 191 }
196 192
197 void SetRequestString(const std::string& method, const std::string& path) { 193 void SetRequestString(const std::string& method, const std::string& path) {
198 SpdyHeaderBlock headers; 194 SpdyHeaderBlock headers;
199 headers[":method"] = method; 195 headers[":method"] = method;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 header_.entropy_flag = false; 287 header_.entropy_flag = false;
292 header_.fec_flag = false; 288 header_.fec_flag = false;
293 } 289 }
294 290
295 QuicEncryptedPacket* ConstructPacket(const QuicPacketHeader& header, 291 QuicEncryptedPacket* ConstructPacket(const QuicPacketHeader& header,
296 const QuicFrame& frame) { 292 const QuicFrame& frame) {
297 QuicFrames frames; 293 QuicFrames frames;
298 frames.push_back(frame); 294 frames.push_back(frame);
299 scoped_ptr<QuicPacket> packet( 295 scoped_ptr<QuicPacket> packet(
300 framer_.ConstructFrameDataPacket(header_, frames).packet); 296 framer_.ConstructFrameDataPacket(header_, frames).packet);
301 return framer_.EncryptPacket(header.packet_sequence_number, *packet); 297 return framer_.EncryptPacket(
298 ENCRYPTION_NONE, header.packet_sequence_number, *packet);
302 } 299 }
303 300
304 const QuicGuid guid_; 301 const QuicGuid guid_;
305 QuicFramer framer_; 302 QuicFramer framer_;
306 IPEndPoint self_addr_; 303 IPEndPoint self_addr_;
307 IPEndPoint peer_addr_; 304 IPEndPoint peer_addr_;
308 MockRandom random_; 305 MockRandom random_;
309 MockCryptoClientStreamFactory crypto_client_stream_factory_; 306 MockCryptoClientStreamFactory crypto_client_stream_factory_;
310 QuicPacketCreator creator_; 307 QuicPacketCreator creator_;
311 QuicPacketHeader header_; 308 QuicPacketHeader header_;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 561
565 // In the course of processing this packet, the QuicHttpStream close itself. 562 // In the course of processing this packet, the QuicHttpStream close itself.
566 ProcessPacket(*resp); 563 ProcessPacket(*resp);
567 564
568 EXPECT_TRUE(AtEof()); 565 EXPECT_TRUE(AtEof());
569 } 566 }
570 567
571 } // namespace test 568 } // namespace test
572 569
573 } // namespace net 570 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698