| 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 26 matching lines...) Expand all Loading... |
| 37 enum { | 37 enum { |
| 38 // A private network error code used by the socket test utility classes. | 38 // A private network error code used by the socket test utility classes. |
| 39 // If the |result| member of a MockRead is | 39 // If the |result| member of a MockRead is |
| 40 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a | 40 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a |
| 41 // marker that indicates the peer will close the connection after the next | 41 // marker that indicates the peer will close the connection after the next |
| 42 // MockRead. The other members of that MockRead are ignored. | 42 // MockRead. The other members of that MockRead are ignored. |
| 43 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, | 43 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 class ClientSocket; | 46 class ClientSocket; |
| 47 class HostPortPair; |
| 47 class HttpRequestHeaders; | 48 class HttpRequestHeaders; |
| 48 class HttpResponseHeaders; | 49 class HttpResponseHeaders; |
| 49 class MockClientSocket; | 50 class MockClientSocket; |
| 50 class SSLClientSocket; | 51 class SSLClientSocket; |
| 51 | 52 |
| 52 struct MockConnect { | 53 struct MockConnect { |
| 53 // Asynchronous connection success. | 54 // Asynchronous connection success. |
| 54 MockConnect() : async(true), result(OK) { } | 55 MockConnect() : async(true), result(OK) { } |
| 55 MockConnect(bool a, int r) : async(a), result(r) { } | 56 MockConnect(bool a, int r) : async(a), result(r) { } |
| 56 | 57 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 396 |
| 396 // Return |index|-th MockSSLClientSocket (starting from 0) that the factory | 397 // Return |index|-th MockSSLClientSocket (starting from 0) that the factory |
| 397 // created. | 398 // created. |
| 398 MockSSLClientSocket* GetMockSSLClientSocket(size_t index) const; | 399 MockSSLClientSocket* GetMockSSLClientSocket(size_t index) const; |
| 399 | 400 |
| 400 // ClientSocketFactory | 401 // ClientSocketFactory |
| 401 virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses, | 402 virtual ClientSocket* CreateTCPClientSocket(const AddressList& addresses, |
| 402 NetLog* net_log); | 403 NetLog* net_log); |
| 403 virtual SSLClientSocket* CreateSSLClientSocket( | 404 virtual SSLClientSocket* CreateSSLClientSocket( |
| 404 ClientSocketHandle* transport_socket, | 405 ClientSocketHandle* transport_socket, |
| 405 const std::string& hostname, | 406 const HostPortPair& host_port_pair, |
| 406 const SSLConfig& ssl_config); | 407 const SSLConfig& ssl_config); |
| 407 | 408 |
| 408 private: | 409 private: |
| 409 SocketDataProviderArray<SocketDataProvider> mock_data_; | 410 SocketDataProviderArray<SocketDataProvider> mock_data_; |
| 410 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; | 411 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
| 411 | 412 |
| 412 // Store pointers to handed out sockets in case the test wants to get them. | 413 // Store pointers to handed out sockets in case the test wants to get them. |
| 413 std::vector<MockTCPClientSocket*> tcp_client_sockets_; | 414 std::vector<MockTCPClientSocket*> tcp_client_sockets_; |
| 414 std::vector<MockSSLClientSocket*> ssl_client_sockets_; | 415 std::vector<MockSSLClientSocket*> ssl_client_sockets_; |
| 415 }; | 416 }; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 | 706 |
| 706 extern const char kSOCKS5OkRequest[]; | 707 extern const char kSOCKS5OkRequest[]; |
| 707 extern const int kSOCKS5OkRequestLength; | 708 extern const int kSOCKS5OkRequestLength; |
| 708 | 709 |
| 709 extern const char kSOCKS5OkResponse[]; | 710 extern const char kSOCKS5OkResponse[]; |
| 710 extern const int kSOCKS5OkResponseLength; | 711 extern const int kSOCKS5OkResponseLength; |
| 711 | 712 |
| 712 } // namespace net | 713 } // namespace net |
| 713 | 714 |
| 714 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 715 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |