| 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 <cstring> | 8 #include <cstring> |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 SSLClientSocket::NextProtoStatus next_proto_status; | 327 SSLClientSocket::NextProtoStatus next_proto_status; |
| 328 std::string next_proto; | 328 std::string next_proto; |
| 329 bool was_npn_negotiated; | 329 bool was_npn_negotiated; |
| 330 NextProto protocol_negotiated; | 330 NextProto protocol_negotiated; |
| 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 // Indicates that the socket should block in the Connect method. | 337 // Indicates that the socket should pause in the Connect method. |
| 338 bool should_block_on_connect; | 338 bool should_pause_on_connect; |
| 339 // Whether or not the Socket should behave like there is a pre-existing | 339 // Whether or not the Socket should behave like there is a pre-existing |
| 340 // session to resume. Whether or not such a session is reported as | 340 // session to resume. Whether or not such a session is reported as |
| 341 // resumed is controlled by |connection_status|. | 341 // resumed is controlled by |connection_status|. |
| 342 bool is_in_session_cache; | 342 bool is_in_session_cache; |
| 343 }; | 343 }; |
| 344 | 344 |
| 345 // A DataProvider where the client must write a request before the reads (e.g. | 345 // A DataProvider where the client must write a request before the reads (e.g. |
| 346 // the response) will complete. | 346 // the response) will complete. |
| 347 class DelayedSocketData : public StaticSocketDataProvider { | 347 class DelayedSocketData : public StaticSocketDataProvider { |
| 348 public: | 348 public: |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 | 983 |
| 984 bool reached_connect() const { return reached_connect_; } | 984 bool reached_connect() const { return reached_connect_; } |
| 985 | 985 |
| 986 // Resumes the connection of a socket that was paused for testing. | 986 // Resumes the connection of a socket that was paused for testing. |
| 987 // |connect_callback_| should be set before invoking this method. | 987 // |connect_callback_| should be set before invoking this method. |
| 988 void RestartPausedConnect(); | 988 void RestartPausedConnect(); |
| 989 | 989 |
| 990 private: | 990 private: |
| 991 enum ConnectState { | 991 enum ConnectState { |
| 992 STATE_NONE, | 992 STATE_NONE, |
| 993 STATE_TRANSPORT_CONNECT, | |
| 994 STATE_TRANSPORT_CONNECT_COMPLETE, | |
| 995 STATE_SSL_CONNECT, | 993 STATE_SSL_CONNECT, |
| 996 STATE_SSL_CONNECT_COMPLETE, | 994 STATE_SSL_CONNECT_COMPLETE, |
| 997 }; | 995 }; |
| 998 | 996 |
| 999 void OnIOComplete(int result); | 997 void OnIOComplete(int result); |
| 1000 | 998 |
| 1001 // Runs the state transistion loop. | 999 // Runs the state transistion loop. |
| 1002 int DoConnectLoop(int result); | 1000 int DoConnectLoop(int result); |
| 1003 | 1001 |
| 1004 int DoTransportConnect(); | |
| 1005 int DoTransportConnectComplete(int result); | |
| 1006 int DoSSLConnect(); | 1002 int DoSSLConnect(); |
| 1007 int DoSSLConnectComplete(int result); | 1003 int DoSSLConnectComplete(int result); |
| 1008 | 1004 |
| 1009 scoped_ptr<ClientSocketHandle> transport_; | 1005 scoped_ptr<ClientSocketHandle> transport_; |
| 1010 SSLSocketDataProvider* data_; | 1006 SSLSocketDataProvider* data_; |
| 1011 bool is_npn_state_set_; | 1007 bool is_npn_state_set_; |
| 1012 bool new_npn_value_; | 1008 bool new_npn_value_; |
| 1013 bool is_protocol_negotiated_set_; | 1009 bool is_protocol_negotiated_set_; |
| 1014 NextProto protocol_negotiated_; | 1010 NextProto protocol_negotiated_; |
| 1015 | 1011 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 | 1326 |
| 1331 extern const char kSOCKS5OkRequest[]; | 1327 extern const char kSOCKS5OkRequest[]; |
| 1332 extern const int kSOCKS5OkRequestLength; | 1328 extern const int kSOCKS5OkRequestLength; |
| 1333 | 1329 |
| 1334 extern const char kSOCKS5OkResponse[]; | 1330 extern const char kSOCKS5OkResponse[]; |
| 1335 extern const int kSOCKS5OkResponseLength; | 1331 extern const int kSOCKS5OkResponseLength; |
| 1336 | 1332 |
| 1337 } // namespace net | 1333 } // namespace net |
| 1338 | 1334 |
| 1339 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1335 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |