| 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 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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::ReliableQuicStreamPeer; |
| 39 using std::string; | 39 using std::string; |
| 40 using std::vector; | 40 using std::vector; |
| 41 using testing::_; |
| 42 using testing::Invoke; |
| 41 | 43 |
| 42 namespace net { | 44 namespace net { |
| 43 namespace test { | 45 namespace test { |
| 44 namespace { | 46 namespace { |
| 45 | 47 |
| 46 // RecordingProofVerifier accepts any certificate chain and records the common | 48 // RecordingProofVerifier accepts any certificate chain and records the common |
| 47 // name of the leaf and then delegates the actual verfication to an actual | 49 // name of the leaf and then delegates the actual verfication to an actual |
| 48 // verifier. If no optional verifier is provided, then VerifyProof will return | 50 // verifier. If no optional verifier is provided, then VerifyProof will return |
| 49 // success. | 51 // success. |
| 50 class RecordingProofVerifier : public ProofVerifier { | 52 class RecordingProofVerifier : public ProofVerifier { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 EpollServer* epoll_server, | 172 EpollServer* epoll_server, |
| 171 std::unique_ptr<ProofVerifier> proof_verifier) | 173 std::unique_ptr<ProofVerifier> proof_verifier) |
| 172 : QuicClient(server_address, | 174 : QuicClient(server_address, |
| 173 server_id, | 175 server_id, |
| 174 supported_versions, | 176 supported_versions, |
| 175 config, | 177 config, |
| 176 epoll_server, | 178 epoll_server, |
| 177 base::WrapUnique( | 179 base::WrapUnique( |
| 178 new RecordingProofVerifier(std::move(proof_verifier)))), | 180 new RecordingProofVerifier(std::move(proof_verifier)))), |
| 179 override_connection_id_(0), | 181 override_connection_id_(0), |
| 180 test_writer_(nullptr) {} | 182 test_writer_(nullptr) { |
| 183 ON_CALL(*this, ProcessPacket(_, _, _)) |
| 184 .WillByDefault(Invoke(this, &MockableQuicClient::ProcessPacketBase)); |
| 185 } |
| 186 |
| 187 void MockableQuicClient::ProcessPacketBase(const IPEndPoint& self_address, |
| 188 const IPEndPoint& peer_address, |
| 189 const QuicReceivedPacket& packet) { |
| 190 QuicClient::ProcessPacket(self_address, peer_address, packet); |
| 191 } |
| 181 | 192 |
| 182 MockableQuicClient::~MockableQuicClient() { | 193 MockableQuicClient::~MockableQuicClient() { |
| 183 if (connected()) { | 194 if (connected()) { |
| 184 Disconnect(); | 195 Disconnect(); |
| 185 } | 196 } |
| 186 } | 197 } |
| 187 | 198 |
| 188 QuicPacketWriter* MockableQuicClient::CreateQuicPacketWriter() { | 199 QuicPacketWriter* MockableQuicClient::CreateQuicPacketWriter() { |
| 189 QuicPacketWriter* writer = QuicClient::CreateQuicPacketWriter(); | 200 QuicPacketWriter* writer = QuicClient::CreateQuicPacketWriter(); |
| 190 if (!test_writer_) { | 201 if (!test_writer_) { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 CHECK(message); | 748 CHECK(message); |
| 738 message->headers()->SetRequestVersion( | 749 message->headers()->SetRequestVersion( |
| 739 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 750 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
| 740 message->headers()->SetRequestMethod( | 751 message->headers()->SetRequestMethod( |
| 741 HTTPMessage::MethodToString(HttpConstants::GET)); | 752 HTTPMessage::MethodToString(HttpConstants::GET)); |
| 742 message->headers()->SetRequestUri(uri); | 753 message->headers()->SetRequestUri(uri); |
| 743 } | 754 } |
| 744 | 755 |
| 745 } // namespace test | 756 } // namespace test |
| 746 } // namespace net | 757 } // namespace net |
| OLD | NEW |