OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <cstring> | 9 #include <cstring> |
10 #include <deque> | 10 #include <deque> |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 530 } |
531 std::vector<MockTCPClientSocket*>& tcp_client_sockets() { | 531 std::vector<MockTCPClientSocket*>& tcp_client_sockets() { |
532 return tcp_client_sockets_; | 532 return tcp_client_sockets_; |
533 } | 533 } |
534 | 534 |
535 // ClientSocketFactory | 535 // ClientSocketFactory |
536 virtual ClientSocket* CreateTCPClientSocket( | 536 virtual ClientSocket* CreateTCPClientSocket( |
537 const AddressList& addresses, | 537 const AddressList& addresses, |
538 NetLog* net_log, | 538 NetLog* net_log, |
539 const NetLog::Source& source); | 539 const NetLog::Source& source); |
| 540 virtual ClientSocket* CreateSCTPClientSocket( |
| 541 const AddressList& addresses, |
| 542 NetLog* net_log, |
| 543 const NetLog::Source& source); |
540 virtual SSLClientSocket* CreateSSLClientSocket( | 544 virtual SSLClientSocket* CreateSSLClientSocket( |
541 ClientSocketHandle* transport_socket, | 545 ClientSocketHandle* transport_socket, |
542 const HostPortPair& host_and_port, | 546 const HostPortPair& host_and_port, |
543 const SSLConfig& ssl_config, | 547 const SSLConfig& ssl_config, |
544 SSLHostInfo* ssl_host_info, | 548 SSLHostInfo* ssl_host_info, |
545 CertVerifier* cert_verifier, | 549 CertVerifier* cert_verifier, |
546 DnsCertProvenanceChecker* dns_cert_checker); | 550 DnsCertProvenanceChecker* dns_cert_checker); |
547 virtual void ClearSSLSessionCache(); | 551 virtual void ClearSSLSessionCache(); |
548 | 552 |
549 private: | 553 private: |
550 SocketDataProviderArray<SocketDataProvider> mock_data_; | 554 SocketDataProviderArray<SocketDataProvider> mock_data_; |
551 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; | 555 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
552 | 556 |
553 // Store pointers to handed out sockets in case the test wants to get them. | 557 // Store pointers to handed out sockets in case the test wants to get them. |
554 std::vector<MockTCPClientSocket*> tcp_client_sockets_; | 558 std::vector<MockTCPClientSocket*> tcp_client_sockets_; |
| 559 std::vector<MockTCPClientSocket*> sctp_client_sockets_; |
555 std::vector<MockSSLClientSocket*> ssl_client_sockets_; | 560 std::vector<MockSSLClientSocket*> ssl_client_sockets_; |
556 }; | 561 }; |
557 | 562 |
558 class MockClientSocket : public net::SSLClientSocket { | 563 class MockClientSocket : public net::SSLClientSocket { |
559 public: | 564 public: |
560 explicit MockClientSocket(net::NetLog* net_log); | 565 explicit MockClientSocket(net::NetLog* net_log); |
561 | 566 |
562 // If an async IO is pending because the SocketDataProvider returned | 567 // If an async IO is pending because the SocketDataProvider returned |
563 // ERR_IO_PENDING, then the MockClientSocket waits until this OnReadComplete | 568 // ERR_IO_PENDING, then the MockClientSocket waits until this OnReadComplete |
564 // is called to complete the asynchronous read operation. | 569 // is called to complete the asynchronous read operation. |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 return mock_data_; | 890 return mock_data_; |
886 } | 891 } |
887 std::vector<DeterministicMockTCPClientSocket*>& tcp_client_sockets() { | 892 std::vector<DeterministicMockTCPClientSocket*>& tcp_client_sockets() { |
888 return tcp_client_sockets_; | 893 return tcp_client_sockets_; |
889 } | 894 } |
890 | 895 |
891 // ClientSocketFactory | 896 // ClientSocketFactory |
892 virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses, | 897 virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses, |
893 NetLog* net_log, | 898 NetLog* net_log, |
894 const NetLog::Source& source); | 899 const NetLog::Source& source); |
| 900 virtual ClientSocket* CreateSCTPClientSocket(const AddressList& addresses, |
| 901 NetLog* net_log, |
| 902 const NetLog::Source& source); |
895 virtual SSLClientSocket* CreateSSLClientSocket( | 903 virtual SSLClientSocket* CreateSSLClientSocket( |
896 ClientSocketHandle* transport_socket, | 904 ClientSocketHandle* transport_socket, |
897 const HostPortPair& host_and_port, | 905 const HostPortPair& host_and_port, |
898 const SSLConfig& ssl_config, | 906 const SSLConfig& ssl_config, |
899 SSLHostInfo* ssl_host_info, | 907 SSLHostInfo* ssl_host_info, |
900 CertVerifier* cert_verifier, | 908 CertVerifier* cert_verifier, |
901 DnsCertProvenanceChecker* dns_cert_checker); | 909 DnsCertProvenanceChecker* dns_cert_checker); |
902 virtual void ClearSSLSessionCache(); | 910 virtual void ClearSSLSessionCache(); |
903 | 911 |
904 private: | 912 private: |
905 SocketDataProviderArray<DeterministicSocketData> mock_data_; | 913 SocketDataProviderArray<DeterministicSocketData> mock_data_; |
906 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; | 914 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
907 | 915 |
908 // Store pointers to handed out sockets in case the test wants to get them. | 916 // Store pointers to handed out sockets in case the test wants to get them. |
909 std::vector<DeterministicMockTCPClientSocket*> tcp_client_sockets_; | 917 std::vector<DeterministicMockTCPClientSocket*> tcp_client_sockets_; |
| 918 std::vector<DeterministicMockTCPClientSocket*> sctp_client_sockets_; |
910 std::vector<MockSSLClientSocket*> ssl_client_sockets_; | 919 std::vector<MockSSLClientSocket*> ssl_client_sockets_; |
911 }; | 920 }; |
912 | 921 |
913 class MockSOCKSClientSocketPool : public SOCKSClientSocketPool { | 922 class MockSOCKSClientSocketPool : public SOCKSClientSocketPool { |
914 public: | 923 public: |
915 MockSOCKSClientSocketPool( | 924 MockSOCKSClientSocketPool( |
916 int max_sockets, | 925 int max_sockets, |
917 int max_sockets_per_group, | 926 int max_sockets_per_group, |
918 ClientSocketPoolHistograms* histograms, | 927 ClientSocketPoolHistograms* histograms, |
919 TCPClientSocketPool* tcp_pool); | 928 TCPClientSocketPool* tcp_pool); |
(...skipping 28 matching lines...) Expand all Loading... |
948 | 957 |
949 extern const char kSOCKS5OkRequest[]; | 958 extern const char kSOCKS5OkRequest[]; |
950 extern const int kSOCKS5OkRequestLength; | 959 extern const int kSOCKS5OkRequestLength; |
951 | 960 |
952 extern const char kSOCKS5OkResponse[]; | 961 extern const char kSOCKS5OkResponse[]; |
953 extern const int kSOCKS5OkResponseLength; | 962 extern const int kSOCKS5OkResponseLength; |
954 | 963 |
955 } // namespace net | 964 } // namespace net |
956 | 965 |
957 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 966 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |