| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 using testing::_; | 43 using testing::_; |
| 44 using testing::AnyNumber; | 44 using testing::AnyNumber; |
| 45 using testing::Return; | 45 using testing::Return; |
| 46 | 46 |
| 47 namespace net { | 47 namespace net { |
| 48 namespace test { | 48 namespace test { |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 const char kUploadData[] = "hello world!"; | 51 const char kUploadData[] = "hello world!"; |
| 52 const char kServerHostname[] = "www.google.com"; |
| 53 const uint16 kServerPort = 80; |
| 52 | 54 |
| 53 class TestQuicConnection : public QuicConnection { | 55 class TestQuicConnection : public QuicConnection { |
| 54 public: | 56 public: |
| 55 TestQuicConnection(const QuicVersionVector& versions, | 57 TestQuicConnection(const QuicVersionVector& versions, |
| 56 QuicConnectionId connection_id, | 58 QuicConnectionId connection_id, |
| 57 IPEndPoint address, | 59 IPEndPoint address, |
| 58 QuicConnectionHelper* helper, | 60 QuicConnectionHelper* helper, |
| 59 QuicPacketWriter* writer) | 61 QuicPacketWriter* writer) |
| 60 : QuicConnection(connection_id, address, helper, writer, false, | 62 : QuicConnection(connection_id, address, helper, writer, false, |
| 61 versions) { | 63 versions) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 connection_->set_visitor(&visitor_); | 201 connection_->set_visitor(&visitor_); |
| 200 connection_->SetSendAlgorithm(send_algorithm_); | 202 connection_->SetSendAlgorithm(send_algorithm_); |
| 201 connection_->SetReceiveAlgorithm(receive_algorithm_); | 203 connection_->SetReceiveAlgorithm(receive_algorithm_); |
| 202 crypto_config_.SetDefaults(); | 204 crypto_config_.SetDefaults(); |
| 203 session_.reset( | 205 session_.reset( |
| 204 new QuicClientSession(connection_, | 206 new QuicClientSession(connection_, |
| 205 scoped_ptr<DatagramClientSocket>(socket), | 207 scoped_ptr<DatagramClientSocket>(socket), |
| 206 writer_.Pass(), NULL, | 208 writer_.Pass(), NULL, |
| 207 make_scoped_ptr((QuicServerInfo*)NULL), | 209 make_scoped_ptr((QuicServerInfo*)NULL), |
| 208 &crypto_client_stream_factory_, | 210 &crypto_client_stream_factory_, |
| 209 "www.google.com", DefaultQuicConfig(), | 211 QuicSessionKey(kServerHostname, kServerPort, |
| 210 &crypto_config_, NULL)); | 212 false), |
| 213 DefaultQuicConfig(), &crypto_config_, NULL)); |
| 211 session_->GetCryptoStream()->CryptoConnect(); | 214 session_->GetCryptoStream()->CryptoConnect(); |
| 212 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); | 215 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); |
| 213 stream_.reset(use_closing_stream_ ? | 216 stream_.reset(use_closing_stream_ ? |
| 214 new AutoClosingStream(session_->GetWeakPtr()) : | 217 new AutoClosingStream(session_->GetWeakPtr()) : |
| 215 new QuicHttpStream(session_->GetWeakPtr())); | 218 new QuicHttpStream(session_->GetWeakPtr())); |
| 216 } | 219 } |
| 217 | 220 |
| 218 void SetRequest(const std::string& method, | 221 void SetRequest(const std::string& method, |
| 219 const std::string& path, | 222 const std::string& path, |
| 220 RequestPriority priority) { | 223 RequestPriority priority) { |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 // Set Delegate to NULL and make sure EffectivePriority returns highest | 611 // Set Delegate to NULL and make sure EffectivePriority returns highest |
| 609 // priority. | 612 // priority. |
| 610 reliable_stream->SetDelegate(NULL); | 613 reliable_stream->SetDelegate(NULL); |
| 611 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, | 614 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, |
| 612 reliable_stream->EffectivePriority()); | 615 reliable_stream->EffectivePriority()); |
| 613 reliable_stream->SetDelegate(delegate); | 616 reliable_stream->SetDelegate(delegate); |
| 614 } | 617 } |
| 615 | 618 |
| 616 } // namespace test | 619 } // namespace test |
| 617 } // namespace net | 620 } // namespace net |
| OLD | NEW |