| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #ifndef NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ |
| 6 #define NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ | 6 #define NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // distinction is necessary to ensure that GetProof can be called without | 28 // distinction is necessary to ensure that GetProof can be called without |
| 29 // interference during test case setup. | 29 // interference during test case setup. |
| 30 void Activate(); | 30 void Activate(); |
| 31 | 31 |
| 32 // ProofSource interface | 32 // ProofSource interface |
| 33 bool GetProof(const IPAddress& server_ip, | 33 bool GetProof(const IPAddress& server_ip, |
| 34 const std::string& hostname, | 34 const std::string& hostname, |
| 35 const std::string& server_config, | 35 const std::string& server_config, |
| 36 QuicVersion quic_version, | 36 QuicVersion quic_version, |
| 37 base::StringPiece chlo_hash, | 37 base::StringPiece chlo_hash, |
| 38 const QuicTagVector& connection_options, |
| 38 scoped_refptr<ProofSource::Chain>* out_chain, | 39 scoped_refptr<ProofSource::Chain>* out_chain, |
| 39 std::string* out_signature, | 40 std::string* out_signature, |
| 40 std::string* out_leaf_cert_sct) override; | 41 std::string* out_leaf_cert_sct) override; |
| 41 void GetProof(const IPAddress& server_ip, | 42 void GetProof(const IPAddress& server_ip, |
| 42 const std::string& hostname, | 43 const std::string& hostname, |
| 43 const std::string& server_config, | 44 const std::string& server_config, |
| 44 QuicVersion quic_version, | 45 QuicVersion quic_version, |
| 45 base::StringPiece chlo_hash, | 46 base::StringPiece chlo_hash, |
| 47 const QuicTagVector& connection_options, |
| 46 std::unique_ptr<ProofSource::Callback> callback) override; | 48 std::unique_ptr<ProofSource::Callback> callback) override; |
| 47 | 49 |
| 48 // Get the number of callbacks which are pending | 50 // Get the number of callbacks which are pending |
| 49 int NumPendingCallbacks() const; | 51 int NumPendingCallbacks() const; |
| 50 | 52 |
| 51 // Invoke a pending callback. The index refers to the position in params_ of | 53 // Invoke a pending callback. The index refers to the position in params_ of |
| 52 // the callback to be completed. | 54 // the callback to be completed. |
| 53 void InvokePendingCallback(int n); | 55 void InvokePendingCallback(int n); |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 std::unique_ptr<ProofSource> delegate_; | 58 std::unique_ptr<ProofSource> delegate_; |
| 57 bool active_ = false; | 59 bool active_ = false; |
| 58 | 60 |
| 59 struct Params { | 61 struct Params { |
| 60 Params(const IPAddress& server_ip, | 62 Params(const IPAddress& server_ip, |
| 61 std::string hostname, | 63 std::string hostname, |
| 62 std::string server_config, | 64 std::string server_config, |
| 63 QuicVersion quic_version, | 65 QuicVersion quic_version, |
| 64 std::string chlo_hash, | 66 std::string chlo_hash, |
| 67 const QuicTagVector& connection_options, |
| 65 std::unique_ptr<ProofSource::Callback> callback); | 68 std::unique_ptr<ProofSource::Callback> callback); |
| 66 ~Params(); | 69 ~Params(); |
| 67 Params(Params&& other); | 70 Params(Params&& other); |
| 68 Params& operator=(Params&& other); | 71 Params& operator=(Params&& other); |
| 69 | 72 |
| 70 IPAddress server_ip; | 73 IPAddress server_ip; |
| 71 std::string hostname; | 74 std::string hostname; |
| 72 std::string server_config; | 75 std::string server_config; |
| 73 QuicVersion quic_version; | 76 QuicVersion quic_version; |
| 74 std::string chlo_hash; | 77 std::string chlo_hash; |
| 78 QuicTagVector connection_options; |
| 75 std::unique_ptr<ProofSource::Callback> callback; | 79 std::unique_ptr<ProofSource::Callback> callback; |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 std::vector<Params> params_; | 82 std::vector<Params> params_; |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 } // namespace test | 85 } // namespace test |
| 82 } // namespace net | 86 } // namespace net |
| 83 | 87 |
| 84 #endif // NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ | 88 #endif // NET_QUIC_TEST_TOOLS_FAKE_PROOF_SOURCE_H_ |
| OLD | NEW |