| 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/tools/quic/test_tools/quic_test_client.h" | 5 #include "net/tools/quic/test_tools/quic_test_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/cert/cert_verify_result.h" | 16 #include "net/cert/cert_verify_result.h" |
| 17 #include "net/cert/x509_certificate.h" | 17 #include "net/cert/x509_certificate.h" |
| 18 #include "net/quic/core/crypto/proof_verifier.h" | 18 #include "net/quic/core/crypto/proof_verifier.h" |
| 19 #include "net/quic/core/quic_flags.h" | 19 #include "net/quic/core/quic_flags.h" |
| 20 #include "net/quic/core/quic_server_id.h" | 20 #include "net/quic/core/quic_server_id.h" |
| 21 #include "net/quic/core/quic_utils.h" | 21 #include "net/quic/core/quic_utils.h" |
| 22 #include "net/quic/core/spdy_utils.h" | 22 #include "net/quic/core/spdy_utils.h" |
| 23 #include "net/quic/test_tools/crypto_test_utils.h" | 23 #include "net/quic/test_tools/crypto_test_utils.h" |
| 24 #include "net/quic/test_tools/quic_connection_peer.h" | 24 #include "net/quic/test_tools/quic_connection_peer.h" |
| 25 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 25 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| 26 #include "net/quic/test_tools/quic_stream_peer.h" |
| 26 #include "net/quic/test_tools/quic_test_utils.h" | 27 #include "net/quic/test_tools/quic_test_utils.h" |
| 27 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | |
| 28 #include "net/tools/quic/quic_epoll_connection_helper.h" | 28 #include "net/tools/quic/quic_epoll_connection_helper.h" |
| 29 #include "net/tools/quic/quic_packet_writer_wrapper.h" | 29 #include "net/tools/quic/quic_packet_writer_wrapper.h" |
| 30 #include "net/tools/quic/quic_spdy_client_stream.h" | 30 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 31 #include "net/tools/quic/test_tools/quic_client_peer.h" | 31 #include "net/tools/quic/test_tools/quic_client_peer.h" |
| 32 #include "url/gurl.h" | 32 #include "url/gurl.h" |
| 33 | 33 |
| 34 using base::StringPiece; | 34 using base::StringPiece; |
| 35 using net::QuicServerId; | 35 using net::QuicServerId; |
| 36 using net::test::QuicConnectionPeer; | 36 using net::test::QuicConnectionPeer; |
| 37 using net::test::QuicSpdySessionPeer; | 37 using net::test::QuicSpdySessionPeer; |
| 38 using net::test::ReliableQuicStreamPeer; | 38 using net::test::QuicStreamPeer; |
| 39 using std::string; | 39 using std::string; |
| 40 using testing::_; | 40 using testing::_; |
| 41 using testing::Invoke; | 41 using testing::Invoke; |
| 42 | 42 |
| 43 namespace net { | 43 namespace net { |
| 44 namespace test { | 44 namespace test { |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 // RecordingProofVerifier accepts any certificate chain and records the common | 47 // RecordingProofVerifier accepts any certificate chain and records the common |
| 48 // name of the leaf and then delegates the actual verfication to an actual | 48 // name of the leaf and then delegates the actual verfication to an actual |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 QuicSpdyClientStream* QuicTestClient::GetOrCreateStream() { | 434 QuicSpdyClientStream* QuicTestClient::GetOrCreateStream() { |
| 435 if (!connect_attempted_ || auto_reconnect_) { | 435 if (!connect_attempted_ || auto_reconnect_) { |
| 436 if (!connected()) { | 436 if (!connected()) { |
| 437 Connect(); | 437 Connect(); |
| 438 } | 438 } |
| 439 if (!connected()) { | 439 if (!connected()) { |
| 440 return nullptr; | 440 return nullptr; |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 if (!stream_) { | 443 if (!stream_) { |
| 444 SetStream(client_->CreateReliableClientStream()); | 444 SetStream(client_->CreateClientStream()); |
| 445 if (stream_) { | 445 if (stream_) { |
| 446 stream_->SetPriority(priority_); | 446 stream_->SetPriority(priority_); |
| 447 stream_->set_allow_bidirectional_data(allow_bidirectional_data_); | 447 stream_->set_allow_bidirectional_data(allow_bidirectional_data_); |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 | 450 |
| 451 return stream_; | 451 return stream_; |
| 452 } | 452 } |
| 453 | 453 |
| 454 QuicErrorCode QuicTestClient::connection_error() { | 454 QuicErrorCode QuicTestClient::connection_error() { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 } else if (uri[0] == '/') { | 686 } else if (uri[0] == '/') { |
| 687 url = "https://" + client_->server_id().host() + uri; | 687 url = "https://" + client_->server_id().host() + uri; |
| 688 } else { | 688 } else { |
| 689 url = "https://" + uri; | 689 url = "https://" + uri; |
| 690 } | 690 } |
| 691 return SpdyUtils::PopulateHeaderBlockFromUrl(url, headers); | 691 return SpdyUtils::PopulateHeaderBlockFromUrl(url, headers); |
| 692 } | 692 } |
| 693 | 693 |
| 694 } // namespace test | 694 } // namespace test |
| 695 } // namespace net | 695 } // namespace net |
| OLD | NEW |