| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 IoMode mode; | 143 IoMode mode; |
| 144 QuicEncryptedPacket* packet; | 144 QuicEncryptedPacket* packet; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 QuicHttpStreamTest() | 147 QuicHttpStreamTest() |
| 148 : net_log_(BoundNetLog()), | 148 : net_log_(BoundNetLog()), |
| 149 use_closing_stream_(false), | 149 use_closing_stream_(false), |
| 150 read_buffer_(new IOBufferWithSize(4096)), | 150 read_buffer_(new IOBufferWithSize(4096)), |
| 151 connection_id_(2), | 151 connection_id_(2), |
| 152 stream_id_(kClientDataStreamId1), | 152 stream_id_(kClientDataStreamId1), |
| 153 maker_(GetParam(), connection_id_), | 153 maker_(GetParam(), connection_id_, &clock_), |
| 154 random_generator_(0) { | 154 random_generator_(0) { |
| 155 IPAddressNumber ip; | 155 IPAddressNumber ip; |
| 156 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); | 156 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); |
| 157 peer_addr_ = IPEndPoint(ip, 443); | 157 peer_addr_ = IPEndPoint(ip, 443); |
| 158 self_addr_ = IPEndPoint(ip, 8435); | 158 self_addr_ = IPEndPoint(ip, 8435); |
| 159 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(20)); |
| 159 } | 160 } |
| 160 | 161 |
| 161 ~QuicHttpStreamTest() { | 162 ~QuicHttpStreamTest() { |
| 162 session_->CloseSessionOnError(ERR_ABORTED); | 163 session_->CloseSessionOnError(ERR_ABORTED); |
| 163 for (size_t i = 0; i < writes_.size(); i++) { | 164 for (size_t i = 0; i < writes_.size(); i++) { |
| 164 delete writes_[i].packet; | 165 delete writes_[i].packet; |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 | 168 |
| 168 // Adds a packet to the list of expected writes. | 169 // Adds a packet to the list of expected writes. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 DefaultQuicConfig(), &crypto_config_, | 237 DefaultQuicConfig(), &crypto_config_, |
| 237 base::MessageLoop::current()-> | 238 base::MessageLoop::current()-> |
| 238 message_loop_proxy().get(), | 239 message_loop_proxy().get(), |
| 239 NULL)); | 240 NULL)); |
| 240 session_->InitializeSession(); | 241 session_->InitializeSession(); |
| 241 session_->GetCryptoStream()->CryptoConnect(); | 242 session_->GetCryptoStream()->CryptoConnect(); |
| 242 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); | 243 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); |
| 243 stream_.reset(use_closing_stream_ ? | 244 stream_.reset(use_closing_stream_ ? |
| 244 new AutoClosingStream(session_->GetWeakPtr()) : | 245 new AutoClosingStream(session_->GetWeakPtr()) : |
| 245 new QuicHttpStream(session_->GetWeakPtr())); | 246 new QuicHttpStream(session_->GetWeakPtr())); |
| 246 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(20)); | |
| 247 } | 247 } |
| 248 | 248 |
| 249 void SetRequest(const std::string& method, | 249 void SetRequest(const std::string& method, |
| 250 const std::string& path, | 250 const std::string& path, |
| 251 RequestPriority priority) { | 251 RequestPriority priority) { |
| 252 request_headers_ = maker_.GetRequestHeaders(method, "http", path); | 252 request_headers_ = maker_.GetRequestHeaders(method, "http", path); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void SetResponse(const std::string& status, const std::string& body) { | 255 void SetResponse(const std::string& status, const std::string& body) { |
| 256 response_headers_ = maker_.GetResponseHeaders(status); | 256 response_headers_ = maker_.GetResponseHeaders(status); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 // Set Delegate to NULL and make sure EffectivePriority returns highest | 731 // Set Delegate to NULL and make sure EffectivePriority returns highest |
| 732 // priority. | 732 // priority. |
| 733 reliable_stream->SetDelegate(NULL); | 733 reliable_stream->SetDelegate(NULL); |
| 734 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 734 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
| 735 reliable_stream->EffectivePriority()); | 735 reliable_stream->EffectivePriority()); |
| 736 reliable_stream->SetDelegate(delegate); | 736 reliable_stream->SetDelegate(delegate); |
| 737 } | 737 } |
| 738 | 738 |
| 739 } // namespace test | 739 } // namespace test |
| 740 } // namespace net | 740 } // namespace net |
| OLD | NEW |