| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 DISALLOW_COPY_AND_ASSIGN(DynamicSocketDataProvider); | 239 DISALLOW_COPY_AND_ASSIGN(DynamicSocketDataProvider); |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 // SSLSocketDataProviders only need to keep track of the return code from calls | 242 // SSLSocketDataProviders only need to keep track of the return code from calls |
| 243 // to Connect(). | 243 // to Connect(). |
| 244 struct SSLSocketDataProvider { | 244 struct SSLSocketDataProvider { |
| 245 SSLSocketDataProvider(bool async, int result) | 245 SSLSocketDataProvider(bool async, int result) |
| 246 : connect(async, result), | 246 : connect(async, result), |
| 247 next_proto_status(SSLClientSocket::kNextProtoUnsupported), | 247 next_proto_status(SSLClientSocket::kNextProtoUnsupported), |
| 248 was_npn_negotiated(false) { } | 248 was_npn_negotiated(false), |
| 249 cert_request_info(NULL) { } |
| 249 | 250 |
| 250 MockConnect connect; | 251 MockConnect connect; |
| 251 SSLClientSocket::NextProtoStatus next_proto_status; | 252 SSLClientSocket::NextProtoStatus next_proto_status; |
| 252 std::string next_proto; | 253 std::string next_proto; |
| 253 bool was_npn_negotiated; | 254 bool was_npn_negotiated; |
| 255 net::SSLCertRequestInfo* cert_request_info; |
| 254 }; | 256 }; |
| 255 | 257 |
| 256 // A DataProvider where the client must write a request before the reads (e.g. | 258 // A DataProvider where the client must write a request before the reads (e.g. |
| 257 // the response) will complete. | 259 // the response) will complete. |
| 258 class DelayedSocketData : public StaticSocketDataProvider, | 260 class DelayedSocketData : public StaticSocketDataProvider, |
| 259 public base::RefCounted<DelayedSocketData> { | 261 public base::RefCounted<DelayedSocketData> { |
| 260 public: | 262 public: |
| 261 // |write_delay| the number of MockWrites to complete before allowing | 263 // |write_delay| the number of MockWrites to complete before allowing |
| 262 // a MockRead to complete. | 264 // a MockRead to complete. |
| 263 // |reads| the list of MockRead completions. | 265 // |reads| the list of MockRead completions. |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 virtual bool UsingTCPFastOpen() const; | 709 virtual bool UsingTCPFastOpen() const; |
| 708 | 710 |
| 709 // Socket methods: | 711 // Socket methods: |
| 710 virtual int Read(net::IOBuffer* buf, int buf_len, | 712 virtual int Read(net::IOBuffer* buf, int buf_len, |
| 711 net::CompletionCallback* callback); | 713 net::CompletionCallback* callback); |
| 712 virtual int Write(net::IOBuffer* buf, int buf_len, | 714 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 713 net::CompletionCallback* callback); | 715 net::CompletionCallback* callback); |
| 714 | 716 |
| 715 // SSLClientSocket methods: | 717 // SSLClientSocket methods: |
| 716 virtual void GetSSLInfo(net::SSLInfo* ssl_info); | 718 virtual void GetSSLInfo(net::SSLInfo* ssl_info); |
| 719 virtual void GetSSLCertRequestInfo( |
| 720 net::SSLCertRequestInfo* cert_request_info); |
| 717 virtual NextProtoStatus GetNextProto(std::string* proto); | 721 virtual NextProtoStatus GetNextProto(std::string* proto); |
| 718 virtual bool was_npn_negotiated() const; | 722 virtual bool was_npn_negotiated() const; |
| 719 virtual bool set_was_npn_negotiated(bool negotiated); | 723 virtual bool set_was_npn_negotiated(bool negotiated); |
| 720 | 724 |
| 721 // This MockSocket does not implement the manual async IO feature. | 725 // This MockSocket does not implement the manual async IO feature. |
| 722 virtual void OnReadComplete(const MockRead& data) { NOTIMPLEMENTED(); } | 726 virtual void OnReadComplete(const MockRead& data) { NOTIMPLEMENTED(); } |
| 723 | 727 |
| 724 private: | 728 private: |
| 725 class ConnectCallback; | 729 class ConnectCallback; |
| 726 | 730 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 | 944 |
| 941 extern const char kSOCKS5OkRequest[]; | 945 extern const char kSOCKS5OkRequest[]; |
| 942 extern const int kSOCKS5OkRequestLength; | 946 extern const int kSOCKS5OkRequestLength; |
| 943 | 947 |
| 944 extern const char kSOCKS5OkResponse[]; | 948 extern const char kSOCKS5OkResponse[]; |
| 945 extern const int kSOCKS5OkResponseLength; | 949 extern const int kSOCKS5OkResponseLength; |
| 946 | 950 |
| 947 } // namespace net | 951 } // namespace net |
| 948 | 952 |
| 949 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 953 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |