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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 // SSLSocketDataProviders only need to keep track of the return code from calls | 257 // SSLSocketDataProviders only need to keep track of the return code from calls |
258 // to Connect(). | 258 // to Connect(). |
259 struct SSLSocketDataProvider { | 259 struct SSLSocketDataProvider { |
260 SSLSocketDataProvider(bool async, int result); | 260 SSLSocketDataProvider(bool async, int result); |
261 ~SSLSocketDataProvider(); | 261 ~SSLSocketDataProvider(); |
262 | 262 |
263 MockConnect connect; | 263 MockConnect connect; |
264 SSLClientSocket::NextProtoStatus next_proto_status; | 264 SSLClientSocket::NextProtoStatus next_proto_status; |
265 std::string next_proto; | 265 std::string next_proto; |
| 266 std::string server_protos; |
266 bool was_npn_negotiated; | 267 bool was_npn_negotiated; |
267 bool client_cert_sent; | 268 bool client_cert_sent; |
268 net::SSLCertRequestInfo* cert_request_info; | 269 net::SSLCertRequestInfo* cert_request_info; |
269 scoped_refptr<X509Certificate> cert; | 270 scoped_refptr<X509Certificate> cert; |
270 }; | 271 }; |
271 | 272 |
272 // A DataProvider where the client must write a request before the reads (e.g. | 273 // A DataProvider where the client must write a request before the reads (e.g. |
273 // the response) will complete. | 274 // the response) will complete. |
274 class DelayedSocketData : public StaticSocketDataProvider, | 275 class DelayedSocketData : public StaticSocketDataProvider, |
275 public base::RefCounted<DelayedSocketData> { | 276 public base::RefCounted<DelayedSocketData> { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 virtual void SetOmniboxSpeculation() OVERRIDE {} | 604 virtual void SetOmniboxSpeculation() OVERRIDE {} |
604 | 605 |
605 // SSLClientSocket methods: | 606 // SSLClientSocket methods: |
606 virtual void GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; | 607 virtual void GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; |
607 virtual void GetSSLCertRequestInfo( | 608 virtual void GetSSLCertRequestInfo( |
608 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; | 609 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; |
609 virtual int ExportKeyingMaterial(const base::StringPiece& label, | 610 virtual int ExportKeyingMaterial(const base::StringPiece& label, |
610 const base::StringPiece& context, | 611 const base::StringPiece& context, |
611 unsigned char *out, | 612 unsigned char *out, |
612 unsigned int outlen) OVERRIDE; | 613 unsigned int outlen) OVERRIDE; |
613 virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; | 614 virtual NextProtoStatus GetNextProto(std::string* proto, |
| 615 std::string* server_protos) OVERRIDE; |
614 | 616 |
615 protected: | 617 protected: |
616 virtual ~MockClientSocket(); | 618 virtual ~MockClientSocket(); |
617 void RunCallbackAsync(net::OldCompletionCallback* callback, int result); | 619 void RunCallbackAsync(net::OldCompletionCallback* callback, int result); |
618 void RunCallback(net::OldCompletionCallback*, int result); | 620 void RunCallback(net::OldCompletionCallback*, int result); |
619 | 621 |
620 ScopedRunnableMethodFactory<MockClientSocket> method_factory_; | 622 ScopedRunnableMethodFactory<MockClientSocket> method_factory_; |
621 | 623 |
622 // True if Connect completed successfully and Disconnect hasn't been called. | 624 // True if Connect completed successfully and Disconnect hasn't been called. |
623 bool connected_; | 625 bool connected_; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 virtual bool IsConnected() const OVERRIDE; | 747 virtual bool IsConnected() const OVERRIDE; |
746 virtual bool WasEverUsed() const OVERRIDE; | 748 virtual bool WasEverUsed() const OVERRIDE; |
747 virtual bool UsingTCPFastOpen() const OVERRIDE; | 749 virtual bool UsingTCPFastOpen() const OVERRIDE; |
748 virtual int64 NumBytesRead() const OVERRIDE; | 750 virtual int64 NumBytesRead() const OVERRIDE; |
749 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 751 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
750 | 752 |
751 // SSLClientSocket methods: | 753 // SSLClientSocket methods: |
752 virtual void GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; | 754 virtual void GetSSLInfo(net::SSLInfo* ssl_info) OVERRIDE; |
753 virtual void GetSSLCertRequestInfo( | 755 virtual void GetSSLCertRequestInfo( |
754 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; | 756 net::SSLCertRequestInfo* cert_request_info) OVERRIDE; |
755 virtual NextProtoStatus GetNextProto(std::string* proto) OVERRIDE; | 757 virtual NextProtoStatus GetNextProto(std::string* proto, |
| 758 std::string* server_protos) OVERRIDE; |
756 virtual bool was_npn_negotiated() const OVERRIDE; | 759 virtual bool was_npn_negotiated() const OVERRIDE; |
757 virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE; | 760 virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE; |
758 | 761 |
759 // This MockSocket does not implement the manual async IO feature. | 762 // This MockSocket does not implement the manual async IO feature. |
760 virtual void OnReadComplete(const MockRead& data) OVERRIDE; | 763 virtual void OnReadComplete(const MockRead& data) OVERRIDE; |
761 | 764 |
762 private: | 765 private: |
763 class ConnectCallback; | 766 class ConnectCallback; |
764 | 767 |
765 scoped_ptr<ClientSocketHandle> transport_; | 768 scoped_ptr<ClientSocketHandle> transport_; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 | 1037 |
1035 extern const char kSOCKS5OkRequest[]; | 1038 extern const char kSOCKS5OkRequest[]; |
1036 extern const int kSOCKS5OkRequestLength; | 1039 extern const int kSOCKS5OkRequestLength; |
1037 | 1040 |
1038 extern const char kSOCKS5OkResponse[]; | 1041 extern const char kSOCKS5OkResponse[]; |
1039 extern const int kSOCKS5OkResponseLength; | 1042 extern const int kSOCKS5OkResponseLength; |
1040 | 1043 |
1041 } // namespace net | 1044 } // namespace net |
1042 | 1045 |
1043 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1046 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |