OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/test_tools/mock_crypto_client_stream_factory.h" | 5 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "net/quic/quic_client_session.h" | 8 #include "net/quic/quic_client_session.h" |
9 #include "net/quic/quic_crypto_client_stream.h" | 9 #include "net/quic/quic_crypto_client_stream.h" |
10 #include "net/quic/quic_server_id.h" | 10 #include "net/quic/quic_server_id.h" |
11 | 11 |
12 using std::string; | 12 using std::string; |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
| 16 MockCryptoClientStreamFactory::~MockCryptoClientStreamFactory() { |
| 17 } |
| 18 |
16 MockCryptoClientStreamFactory::MockCryptoClientStreamFactory() | 19 MockCryptoClientStreamFactory::MockCryptoClientStreamFactory() |
17 : handshake_mode_(MockCryptoClientStream::CONFIRM_HANDSHAKE), | 20 : handshake_mode_(MockCryptoClientStream::CONFIRM_HANDSHAKE), |
18 last_stream_(nullptr), | 21 last_stream_(nullptr), |
19 proof_verify_details_(nullptr) { | 22 default_proof_verify_details_(nullptr) { |
20 } | 23 } |
21 | 24 |
22 QuicCryptoClientStream* | 25 QuicCryptoClientStream* |
23 MockCryptoClientStreamFactory::CreateQuicCryptoClientStream( | 26 MockCryptoClientStreamFactory::CreateQuicCryptoClientStream( |
24 const QuicServerId& server_id, | 27 const QuicServerId& server_id, |
25 QuicClientSession* session, | 28 QuicClientSession* session, |
26 QuicCryptoClientConfig* crypto_config) { | 29 QuicCryptoClientConfig* crypto_config) { |
27 last_stream_ = new MockCryptoClientStream( | 30 ProofVerifyDetailsMap::iterator it = |
28 server_id, session, nullptr, crypto_config, handshake_mode_, | 31 proof_verify_details_map_.find(server_id); |
29 proof_verify_details_); | 32 const ProofVerifyDetails* proof_verify_details = |
| 33 (it == proof_verify_details_map_.end() ? default_proof_verify_details_ |
| 34 : it->second); |
| 35 last_stream_ = |
| 36 new MockCryptoClientStream(server_id, session, nullptr, crypto_config, |
| 37 handshake_mode_, proof_verify_details); |
30 return last_stream_; | 38 return last_stream_; |
31 } | 39 } |
32 | 40 |
33 } // namespace net | 41 } // namespace net |
OLD | NEW |