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

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

Issue 192583004: QUIC - use QuicSessionKey tuple (host, port, is_https) instead of server_hostname (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use QuicSessionKey as arg and delete server_hostname as arg Created 6 years, 9 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
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 30 matching lines...) Expand all
41 41
42 using testing::_; 42 using testing::_;
43 using testing::AnyNumber; 43 using testing::AnyNumber;
44 using testing::Return; 44 using testing::Return;
45 45
46 namespace net { 46 namespace net {
47 namespace test { 47 namespace test {
48 namespace { 48 namespace {
49 49
50 const char kUploadData[] = "hello world!"; 50 const char kUploadData[] = "hello world!";
51 const char kServerHostname[] = "www.google.com";
52 const uint16 kServerPort = 80;
51 53
52 class TestQuicConnection : public QuicConnection { 54 class TestQuicConnection : public QuicConnection {
53 public: 55 public:
54 TestQuicConnection(const QuicVersionVector& versions, 56 TestQuicConnection(const QuicVersionVector& versions,
55 QuicConnectionId connection_id, 57 QuicConnectionId connection_id,
56 IPEndPoint address, 58 IPEndPoint address,
57 QuicConnectionHelper* helper, 59 QuicConnectionHelper* helper,
58 QuicPacketWriter* writer) 60 QuicPacketWriter* writer)
59 : QuicConnection(connection_id, address, helper, writer, false, 61 : QuicConnection(connection_id, address, helper, writer, false,
60 versions) { 62 versions) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 : mode(mode), 119 : mode(mode),
118 packet(packet) { 120 packet(packet) {
119 } 121 }
120 IoMode mode; 122 IoMode mode;
121 QuicEncryptedPacket* packet; 123 QuicEncryptedPacket* packet;
122 }; 124 };
123 125
124 QuicHttpStreamTest() 126 QuicHttpStreamTest()
125 : net_log_(BoundNetLog()), 127 : net_log_(BoundNetLog()),
126 use_closing_stream_(false), 128 use_closing_stream_(false),
129 session_key_(kServerHostname, kServerPort, false),
127 read_buffer_(new IOBufferWithSize(4096)), 130 read_buffer_(new IOBufferWithSize(4096)),
128 connection_id_(2), 131 connection_id_(2),
129 stream_id_(5), 132 stream_id_(5),
130 maker_(GetParam(), connection_id_), 133 maker_(GetParam(), connection_id_),
131 random_generator_(0) { 134 random_generator_(0) {
132 IPAddressNumber ip; 135 IPAddressNumber ip;
133 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); 136 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip));
134 peer_addr_ = IPEndPoint(ip, 443); 137 peer_addr_ = IPEndPoint(ip, 443);
135 self_addr_ = IPEndPoint(ip, 8435); 138 self_addr_ = IPEndPoint(ip, 8435);
136 } 139 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 connection_id_, peer_addr_, 199 connection_id_, peer_addr_,
197 helper_.get(), writer_.get()); 200 helper_.get(), writer_.get());
198 connection_->set_visitor(&visitor_); 201 connection_->set_visitor(&visitor_);
199 connection_->SetSendAlgorithm(send_algorithm_); 202 connection_->SetSendAlgorithm(send_algorithm_);
200 connection_->SetReceiveAlgorithm(receive_algorithm_); 203 connection_->SetReceiveAlgorithm(receive_algorithm_);
201 crypto_config_.SetDefaults(); 204 crypto_config_.SetDefaults();
202 session_.reset( 205 session_.reset(
203 new QuicClientSession(connection_, 206 new QuicClientSession(connection_,
204 scoped_ptr<DatagramClientSocket>(socket), 207 scoped_ptr<DatagramClientSocket>(socket),
205 writer_.Pass(), NULL, 208 writer_.Pass(), NULL,
206 &crypto_client_stream_factory_, 209 &crypto_client_stream_factory_, session_key_,
207 "www.google.com", DefaultQuicConfig(), 210 DefaultQuicConfig(), &crypto_config_, NULL));
208 &crypto_config_, NULL));
209 session_->GetCryptoStream()->CryptoConnect(); 211 session_->GetCryptoStream()->CryptoConnect();
210 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); 212 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
211 stream_.reset(use_closing_stream_ ? 213 stream_.reset(use_closing_stream_ ?
212 new AutoClosingStream(session_->GetWeakPtr()) : 214 new AutoClosingStream(session_->GetWeakPtr()) :
213 new QuicHttpStream(session_->GetWeakPtr())); 215 new QuicHttpStream(session_->GetWeakPtr()));
214 } 216 }
215 217
216 void SetRequest(const std::string& method, 218 void SetRequest(const std::string& method,
217 const std::string& path, 219 const std::string& path,
218 RequestPriority priority) { 220 RequestPriority priority) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 TestReceiveAlgorithm* receive_algorithm_; 277 TestReceiveAlgorithm* receive_algorithm_;
276 scoped_refptr<TestTaskRunner> runner_; 278 scoped_refptr<TestTaskRunner> runner_;
277 scoped_ptr<MockWrite[]> mock_writes_; 279 scoped_ptr<MockWrite[]> mock_writes_;
278 MockClock clock_; 280 MockClock clock_;
279 TestQuicConnection* connection_; 281 TestQuicConnection* connection_;
280 scoped_ptr<QuicConnectionHelper> helper_; 282 scoped_ptr<QuicConnectionHelper> helper_;
281 testing::StrictMock<MockConnectionVisitor> visitor_; 283 testing::StrictMock<MockConnectionVisitor> visitor_;
282 scoped_ptr<QuicHttpStream> stream_; 284 scoped_ptr<QuicHttpStream> stream_;
283 scoped_ptr<QuicDefaultPacketWriter> writer_; 285 scoped_ptr<QuicDefaultPacketWriter> writer_;
284 scoped_ptr<QuicClientSession> session_; 286 scoped_ptr<QuicClientSession> session_;
287 QuicSessionKey session_key_;
285 QuicCryptoClientConfig crypto_config_; 288 QuicCryptoClientConfig crypto_config_;
286 TestCompletionCallback callback_; 289 TestCompletionCallback callback_;
287 HttpRequestInfo request_; 290 HttpRequestInfo request_;
288 HttpRequestHeaders headers_; 291 HttpRequestHeaders headers_;
289 HttpResponseInfo response_; 292 HttpResponseInfo response_;
290 scoped_refptr<IOBufferWithSize> read_buffer_; 293 scoped_refptr<IOBufferWithSize> read_buffer_;
291 SpdyHeaderBlock request_headers_; 294 SpdyHeaderBlock request_headers_;
292 SpdyHeaderBlock response_headers_; 295 SpdyHeaderBlock response_headers_;
293 std::string request_data_; 296 std::string request_data_;
294 std::string response_data_; 297 std::string response_data_;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // Set Delegate to NULL and make sure EffectivePriority returns highest 609 // Set Delegate to NULL and make sure EffectivePriority returns highest
607 // priority. 610 // priority.
608 reliable_stream->SetDelegate(NULL); 611 reliable_stream->SetDelegate(NULL);
609 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, 612 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
610 reliable_stream->EffectivePriority()); 613 reliable_stream->EffectivePriority());
611 reliable_stream->SetDelegate(delegate); 614 reliable_stream->SetDelegate(delegate);
612 } 615 }
613 616
614 } // namespace test 617 } // namespace test
615 } // namespace net 618 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698