| 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 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ | 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ | 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cstring> | 10 #include <cstring> |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 MockConnect connect; | 327 MockConnect connect; |
| 328 SSLClientSocket::NextProtoStatus next_proto_status; | 328 SSLClientSocket::NextProtoStatus next_proto_status; |
| 329 std::string next_proto; | 329 std::string next_proto; |
| 330 NextProtoVector next_protos_expected_in_ssl_config; | 330 NextProtoVector next_protos_expected_in_ssl_config; |
| 331 bool client_cert_sent; | 331 bool client_cert_sent; |
| 332 SSLCertRequestInfo* cert_request_info; | 332 SSLCertRequestInfo* cert_request_info; |
| 333 scoped_refptr<X509Certificate> cert; | 333 scoped_refptr<X509Certificate> cert; |
| 334 bool channel_id_sent; | 334 bool channel_id_sent; |
| 335 ChannelIDService* channel_id_service; | 335 ChannelIDService* channel_id_service; |
| 336 int connection_status; | 336 int connection_status; |
| 337 bool token_binding_negotiated; |
| 338 TokenBindingParam token_binding_key_param; |
| 337 }; | 339 }; |
| 338 | 340 |
| 339 // Uses the sequence_number field in the mock reads and writes to | 341 // Uses the sequence_number field in the mock reads and writes to |
| 340 // complete the operations in a specified order. | 342 // complete the operations in a specified order. |
| 341 class SequencedSocketData : public SocketDataProvider { | 343 class SequencedSocketData : public SocketDataProvider { |
| 342 public: | 344 public: |
| 343 // |reads| is the list of MockRead completions. | 345 // |reads| is the list of MockRead completions. |
| 344 // |writes| is the list of MockWrite completions. | 346 // |writes| is the list of MockWrite completions. |
| 345 SequencedSocketData(MockRead* reads, | 347 SequencedSocketData(MockRead* reads, |
| 346 size_t reads_count, | 348 size_t reads_count, |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 // SSLClientSocket implementation. | 656 // SSLClientSocket implementation. |
| 655 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 657 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
| 656 int ExportKeyingMaterial(const base::StringPiece& label, | 658 int ExportKeyingMaterial(const base::StringPiece& label, |
| 657 bool has_context, | 659 bool has_context, |
| 658 const base::StringPiece& context, | 660 const base::StringPiece& context, |
| 659 unsigned char* out, | 661 unsigned char* out, |
| 660 unsigned int outlen) override; | 662 unsigned int outlen) override; |
| 661 int GetTLSUniqueChannelBinding(std::string* out) override; | 663 int GetTLSUniqueChannelBinding(std::string* out) override; |
| 662 NextProtoStatus GetNextProto(std::string* proto) const override; | 664 NextProtoStatus GetNextProto(std::string* proto) const override; |
| 663 ChannelIDService* GetChannelIDService() const override; | 665 ChannelIDService* GetChannelIDService() const override; |
| 666 int GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
| 667 std::vector<uint8_t>* out) override; |
| 664 SSLFailureState GetSSLFailureState() const override; | 668 SSLFailureState GetSSLFailureState() const override; |
| 665 | 669 |
| 666 protected: | 670 protected: |
| 667 ~MockClientSocket() override; | 671 ~MockClientSocket() override; |
| 668 void RunCallbackAsync(const CompletionCallback& callback, int result); | 672 void RunCallbackAsync(const CompletionCallback& callback, int result); |
| 669 void RunCallback(const CompletionCallback& callback, int result); | 673 void RunCallback(const CompletionCallback& callback, int result); |
| 670 | 674 |
| 671 // True if Connect completed successfully and Disconnect hasn't been called. | 675 // True if Connect completed successfully and Disconnect hasn't been called. |
| 672 bool connected_; | 676 bool connected_; |
| 673 | 677 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 int Connect(const CompletionCallback& callback) override; | 902 int Connect(const CompletionCallback& callback) override; |
| 899 void Disconnect() override; | 903 void Disconnect() override; |
| 900 bool IsConnected() const override; | 904 bool IsConnected() const override; |
| 901 bool WasEverUsed() const override; | 905 bool WasEverUsed() const override; |
| 902 bool UsingTCPFastOpen() const override; | 906 bool UsingTCPFastOpen() const override; |
| 903 int GetPeerAddress(IPEndPoint* address) const override; | 907 int GetPeerAddress(IPEndPoint* address) const override; |
| 904 bool GetSSLInfo(SSLInfo* ssl_info) override; | 908 bool GetSSLInfo(SSLInfo* ssl_info) override; |
| 905 | 909 |
| 906 // SSLClientSocket implementation. | 910 // SSLClientSocket implementation. |
| 907 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 911 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
| 912 int GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
| 913 std::vector<uint8_t>* out) override; |
| 908 NextProtoStatus GetNextProto(std::string* proto) const override; | 914 NextProtoStatus GetNextProto(std::string* proto) const override; |
| 909 | 915 |
| 910 // This MockSocket does not implement the manual async IO feature. | 916 // This MockSocket does not implement the manual async IO feature. |
| 911 void OnReadComplete(const MockRead& data) override; | 917 void OnReadComplete(const MockRead& data) override; |
| 912 void OnWriteComplete(int rv) override; | 918 void OnWriteComplete(int rv) override; |
| 913 void OnConnectComplete(const MockConnect& data) override; | 919 void OnConnectComplete(const MockConnect& data) override; |
| 914 | 920 |
| 915 ChannelIDService* GetChannelIDService() const override; | 921 ChannelIDService* GetChannelIDService() const override; |
| 916 | 922 |
| 917 private: | 923 private: |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1254 |
| 1249 // Helper function to get the total data size of the MockReads in |reads|. | 1255 // Helper function to get the total data size of the MockReads in |reads|. |
| 1250 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 1256 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
| 1251 | 1257 |
| 1252 // Helper function to get the total data size of the MockWrites in |writes|. | 1258 // Helper function to get the total data size of the MockWrites in |writes|. |
| 1253 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1259 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
| 1254 | 1260 |
| 1255 } // namespace net | 1261 } // namespace net |
| 1256 | 1262 |
| 1257 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1263 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |