| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 const SSLConfig& ssl_config, | 540 const SSLConfig& ssl_config, |
| 541 SSLHostInfo* ssl_host_info, | 541 SSLHostInfo* ssl_host_info, |
| 542 CertVerifier* cert_verifier, | 542 CertVerifier* cert_verifier, |
| 543 DnsCertProvenanceChecker* dns_cert_checker); | 543 DnsCertProvenanceChecker* dns_cert_checker); |
| 544 SocketDataProviderArray<SocketDataProvider>& mock_data() { | 544 SocketDataProviderArray<SocketDataProvider>& mock_data() { |
| 545 return mock_data_; | 545 return mock_data_; |
| 546 } | 546 } |
| 547 std::vector<MockTCPClientSocket*>& tcp_client_sockets() { | 547 std::vector<MockTCPClientSocket*>& tcp_client_sockets() { |
| 548 return tcp_client_sockets_; | 548 return tcp_client_sockets_; |
| 549 } | 549 } |
| 550 std::vector<MockSSLClientSocket*>& ssl_client_sockets() { |
| 551 return ssl_client_sockets_; |
| 552 } |
| 550 | 553 |
| 551 private: | 554 private: |
| 552 SocketDataProviderArray<SocketDataProvider> mock_data_; | 555 SocketDataProviderArray<SocketDataProvider> mock_data_; |
| 553 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; | 556 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
| 554 | 557 |
| 555 // Store pointers to handed out sockets in case the test wants to get them. | 558 // Store pointers to handed out sockets in case the test wants to get them. |
| 556 std::vector<MockTCPClientSocket*> tcp_client_sockets_; | 559 std::vector<MockTCPClientSocket*> tcp_client_sockets_; |
| 557 std::vector<MockSSLClientSocket*> ssl_client_sockets_; | 560 std::vector<MockSSLClientSocket*> ssl_client_sockets_; |
| 558 }; | 561 }; |
| 559 | 562 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 virtual void GetSSLInfo(net::SSLInfo* ssl_info); | 721 virtual void GetSSLInfo(net::SSLInfo* ssl_info); |
| 719 virtual void GetSSLCertRequestInfo( | 722 virtual void GetSSLCertRequestInfo( |
| 720 net::SSLCertRequestInfo* cert_request_info); | 723 net::SSLCertRequestInfo* cert_request_info); |
| 721 virtual NextProtoStatus GetNextProto(std::string* proto); | 724 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 722 virtual bool was_npn_negotiated() const; | 725 virtual bool was_npn_negotiated() const; |
| 723 virtual bool set_was_npn_negotiated(bool negotiated); | 726 virtual bool set_was_npn_negotiated(bool negotiated); |
| 724 | 727 |
| 725 // This MockSocket does not implement the manual async IO feature. | 728 // This MockSocket does not implement the manual async IO feature. |
| 726 virtual void OnReadComplete(const MockRead& data) { NOTIMPLEMENTED(); } | 729 virtual void OnReadComplete(const MockRead& data) { NOTIMPLEMENTED(); } |
| 727 | 730 |
| 731 const HostPortPair& GetHostAndPort() const { |
| 732 return host_and_port_; |
| 733 } |
| 734 |
| 735 const SSLConfig& GetSSLConfig() const { |
| 736 return ssl_config_; |
| 737 } |
| 738 |
| 728 private: | 739 private: |
| 729 class ConnectCallback; | 740 class ConnectCallback; |
| 730 | 741 |
| 731 scoped_ptr<ClientSocketHandle> transport_; | 742 scoped_ptr<ClientSocketHandle> transport_; |
| 732 net::SSLSocketDataProvider* data_; | 743 net::SSLSocketDataProvider* data_; |
| 733 bool is_npn_state_set_; | 744 bool is_npn_state_set_; |
| 734 bool new_npn_value_; | 745 bool new_npn_value_; |
| 735 bool was_used_to_convey_data_; | 746 bool was_used_to_convey_data_; |
| 747 HostPortPair host_and_port_; |
| 748 SSLConfig ssl_config_; |
| 736 }; | 749 }; |
| 737 | 750 |
| 738 class TestSocketRequest : public CallbackRunner< Tuple1<int> > { | 751 class TestSocketRequest : public CallbackRunner< Tuple1<int> > { |
| 739 public: | 752 public: |
| 740 TestSocketRequest( | 753 TestSocketRequest( |
| 741 std::vector<TestSocketRequest*>* request_order, | 754 std::vector<TestSocketRequest*>* request_order, |
| 742 size_t* completion_count); | 755 size_t* completion_count); |
| 743 virtual ~TestSocketRequest(); | 756 virtual ~TestSocketRequest(); |
| 744 | 757 |
| 745 ClientSocketHandle* handle() { return &handle_; } | 758 ClientSocketHandle* handle() { return &handle_; } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 | 957 |
| 945 extern const char kSOCKS5OkRequest[]; | 958 extern const char kSOCKS5OkRequest[]; |
| 946 extern const int kSOCKS5OkRequestLength; | 959 extern const int kSOCKS5OkRequestLength; |
| 947 | 960 |
| 948 extern const char kSOCKS5OkResponse[]; | 961 extern const char kSOCKS5OkResponse[]; |
| 949 extern const int kSOCKS5OkResponseLength; | 962 extern const int kSOCKS5OkResponseLength; |
| 950 | 963 |
| 951 } // namespace net | 964 } // namespace net |
| 952 | 965 |
| 953 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 966 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |