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