OLD | NEW |
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 WillRepeatedly(testing::Return(QuicTime::Delta::Zero())); | 172 WillRepeatedly(testing::Return(QuicTime::Delta::Zero())); |
173 helper_ = new QuicConnectionHelper(runner_.get(), &clock_, | 173 helper_ = new QuicConnectionHelper(runner_.get(), &clock_, |
174 &random_generator_, socket); | 174 &random_generator_, socket); |
175 connection_ = new TestQuicConnection(guid_, peer_addr_, helper_); | 175 connection_ = new TestQuicConnection(guid_, peer_addr_, helper_); |
176 connection_->set_visitor(&visitor_); | 176 connection_->set_visitor(&visitor_); |
177 connection_->SetSendAlgorithm(send_algorithm_); | 177 connection_->SetSendAlgorithm(send_algorithm_); |
178 connection_->SetReceiveAlgorithm(receive_algorithm_); | 178 connection_->SetReceiveAlgorithm(receive_algorithm_); |
179 crypto_config_.SetDefaults(); | 179 crypto_config_.SetDefaults(); |
180 session_.reset(new QuicClientSession(connection_, socket, NULL, | 180 session_.reset(new QuicClientSession(connection_, socket, NULL, |
181 &crypto_client_stream_factory_, | 181 &crypto_client_stream_factory_, |
182 "www.google.com", &crypto_config_, | 182 "www.google.com", QuicConfig(), |
183 NULL)); | 183 &crypto_config_, NULL)); |
184 session_->GetCryptoStream()->CryptoConnect(); | 184 session_->GetCryptoStream()->CryptoConnect(); |
185 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); | 185 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); |
186 QuicReliableClientStream* stream = | 186 QuicReliableClientStream* stream = |
187 session_->CreateOutgoingReliableStream(); | 187 session_->CreateOutgoingReliableStream(); |
188 stream_.reset(use_closing_stream_ ? | 188 stream_.reset(use_closing_stream_ ? |
189 new AutoClosingStream(stream) : | 189 new AutoClosingStream(stream) : |
190 new QuicHttpStream(stream)); | 190 new QuicHttpStream(stream)); |
191 } | 191 } |
192 | 192 |
193 void SetRequestString(const std::string& method, const std::string& path) { | 193 void SetRequestString(const std::string& method, const std::string& path) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 TestReceiveAlgorithm* receive_algorithm_; | 258 TestReceiveAlgorithm* receive_algorithm_; |
259 scoped_refptr<TestTaskRunner> runner_; | 259 scoped_refptr<TestTaskRunner> runner_; |
260 scoped_ptr<MockWrite[]> mock_writes_; | 260 scoped_ptr<MockWrite[]> mock_writes_; |
261 MockClock clock_; | 261 MockClock clock_; |
262 MockRandom random_generator_; | 262 MockRandom random_generator_; |
263 TestQuicConnection* connection_; | 263 TestQuicConnection* connection_; |
264 QuicConnectionHelper* helper_; | 264 QuicConnectionHelper* helper_; |
265 testing::StrictMock<MockConnectionVisitor> visitor_; | 265 testing::StrictMock<MockConnectionVisitor> visitor_; |
266 scoped_ptr<QuicHttpStream> stream_; | 266 scoped_ptr<QuicHttpStream> stream_; |
267 scoped_ptr<QuicClientSession> session_; | 267 scoped_ptr<QuicClientSession> session_; |
268 QuicConfig* config_; | |
269 QuicCryptoClientConfig crypto_config_; | 268 QuicCryptoClientConfig crypto_config_; |
270 TestCompletionCallback callback_; | 269 TestCompletionCallback callback_; |
271 HttpRequestInfo request_; | 270 HttpRequestInfo request_; |
272 HttpRequestHeaders headers_; | 271 HttpRequestHeaders headers_; |
273 HttpResponseInfo response_; | 272 HttpResponseInfo response_; |
274 scoped_refptr<IOBufferWithSize> read_buffer_; | 273 scoped_refptr<IOBufferWithSize> read_buffer_; |
275 std::string request_data_; | 274 std::string request_data_; |
276 std::string response_data_; | 275 std::string response_data_; |
277 | 276 |
278 private: | 277 private: |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 559 |
561 // In the course of processing this packet, the QuicHttpStream close itself. | 560 // In the course of processing this packet, the QuicHttpStream close itself. |
562 ProcessPacket(*resp); | 561 ProcessPacket(*resp); |
563 | 562 |
564 EXPECT_TRUE(AtEof()); | 563 EXPECT_TRUE(AtEof()); |
565 } | 564 } |
566 | 565 |
567 } // namespace test | 566 } // namespace test |
568 | 567 |
569 } // namespace net | 568 } // namespace net |
OLD | NEW |