| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE; | 479 virtual MockWriteResult OnWrite(const std::string& data) OVERRIDE; |
| 480 virtual void Reset() OVERRIDE; | 480 virtual void Reset() OVERRIDE; |
| 481 virtual void CompleteRead() OVERRIDE {} | 481 virtual void CompleteRead() OVERRIDE {} |
| 482 | 482 |
| 483 private: | 483 private: |
| 484 // Invoke the read and write callbacks, if the timing is appropriate. | 484 // Invoke the read and write callbacks, if the timing is appropriate. |
| 485 void InvokeCallbacks(); | 485 void InvokeCallbacks(); |
| 486 | 486 |
| 487 void NextStep(); | 487 void NextStep(); |
| 488 | 488 |
| 489 void VerifyCorrectSequenceNumbers(MockRead* reads, size_t reads_count, |
| 490 MockWrite* writes, size_t writes_count); |
| 491 |
| 489 int sequence_number_; | 492 int sequence_number_; |
| 490 MockRead current_read_; | 493 MockRead current_read_; |
| 491 MockWrite current_write_; | 494 MockWrite current_write_; |
| 492 int stopping_sequence_number_; | 495 int stopping_sequence_number_; |
| 493 bool stopped_; | 496 bool stopped_; |
| 494 base::WeakPtr<DeterministicMockTCPClientSocket> socket_; | 497 base::WeakPtr<DeterministicMockTCPClientSocket> socket_; |
| 495 bool print_debug_; | 498 bool print_debug_; |
| 496 }; | 499 }; |
| 497 | 500 |
| 498 // Holds an array of SocketDataProvider elements. As Mock{TCP,SSL}StreamSocket | 501 // Holds an array of SocketDataProvider elements. As Mock{TCP,SSL}StreamSocket |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; | 755 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; |
| 753 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 756 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
| 754 virtual bool WasNpnNegotiated() const OVERRIDE; | 757 virtual bool WasNpnNegotiated() const OVERRIDE; |
| 755 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 758 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
| 756 | 759 |
| 757 // SSLClientSocket implementation. | 760 // SSLClientSocket implementation. |
| 758 virtual void GetSSLCertRequestInfo( | 761 virtual void GetSSLCertRequestInfo( |
| 759 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 762 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
| 760 virtual NextProtoStatus GetNextProto(std::string* proto, | 763 virtual NextProtoStatus GetNextProto(std::string* proto, |
| 761 std::string* server_protos) OVERRIDE; | 764 std::string* server_protos) OVERRIDE; |
| 762 //virtual bool was_npn_negotiated() const OVERRIDE; | |
| 763 virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE; | 765 virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE; |
| 764 virtual void set_protocol_negotiated( | 766 virtual void set_protocol_negotiated( |
| 765 NextProto protocol_negotiated) OVERRIDE; | 767 NextProto protocol_negotiated) OVERRIDE; |
| 766 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; | 768 virtual NextProto GetNegotiatedProtocol() const OVERRIDE; |
| 767 | 769 |
| 768 // This MockSocket does not implement the manual async IO feature. | 770 // This MockSocket does not implement the manual async IO feature. |
| 769 virtual void OnReadComplete(const MockRead& data) OVERRIDE; | 771 virtual void OnReadComplete(const MockRead& data) OVERRIDE; |
| 770 | 772 |
| 771 virtual bool WasChannelIDSent() const OVERRIDE; | 773 virtual bool WasChannelIDSent() const OVERRIDE; |
| 772 virtual void set_channel_id_sent(bool channel_id_sent) OVERRIDE; | 774 virtual void set_channel_id_sent(bool channel_id_sent) OVERRIDE; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 | 1053 |
| 1052 extern const char kSOCKS5OkRequest[]; | 1054 extern const char kSOCKS5OkRequest[]; |
| 1053 extern const int kSOCKS5OkRequestLength; | 1055 extern const int kSOCKS5OkRequestLength; |
| 1054 | 1056 |
| 1055 extern const char kSOCKS5OkResponse[]; | 1057 extern const char kSOCKS5OkResponse[]; |
| 1056 extern const int kSOCKS5OkResponseLength; | 1058 extern const int kSOCKS5OkResponseLength; |
| 1057 | 1059 |
| 1058 } // namespace net | 1060 } // namespace net |
| 1059 | 1061 |
| 1060 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1062 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |