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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 public: | 585 public: |
586 explicit MockClientSocket(net::NetLog* net_log); | 586 explicit MockClientSocket(net::NetLog* net_log); |
587 | 587 |
588 // Socket implementation. | 588 // Socket implementation. |
589 virtual int Read(net::IOBuffer* buf, int buf_len, | 589 virtual int Read(net::IOBuffer* buf, int buf_len, |
590 net::OldCompletionCallback* callback) = 0; | 590 net::OldCompletionCallback* callback) = 0; |
591 virtual int Read(net::IOBuffer* buf, int buf_len, | 591 virtual int Read(net::IOBuffer* buf, int buf_len, |
592 const net::CompletionCallback& callback) = 0; | 592 const net::CompletionCallback& callback) = 0; |
593 virtual int Write(net::IOBuffer* buf, int buf_len, | 593 virtual int Write(net::IOBuffer* buf, int buf_len, |
594 net::OldCompletionCallback* callback) = 0; | 594 net::OldCompletionCallback* callback) = 0; |
595 virtual int Write(net::IOBuffer* buf, int buf_len, | |
596 const net::CompletionCallback& callback) = 0; | |
597 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 595 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
598 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 596 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
599 | 597 |
600 // StreamSocket implementation. | 598 // StreamSocket implementation. |
601 virtual int Connect(net::OldCompletionCallback* callback) = 0; | 599 virtual int Connect(net::OldCompletionCallback* callback) = 0; |
602 virtual int Connect(const net::CompletionCallback& callback) = 0; | 600 virtual int Connect(const net::CompletionCallback& callback) = 0; |
603 virtual void Disconnect() OVERRIDE; | 601 virtual void Disconnect() OVERRIDE; |
604 virtual bool IsConnected() const OVERRIDE; | 602 virtual bool IsConnected() const OVERRIDE; |
605 virtual bool IsConnectedAndIdle() const OVERRIDE; | 603 virtual bool IsConnectedAndIdle() const OVERRIDE; |
606 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; | 604 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 641 |
644 net::AddressList addresses() const { return addresses_; } | 642 net::AddressList addresses() const { return addresses_; } |
645 | 643 |
646 // Socket implementation. | 644 // Socket implementation. |
647 virtual int Read(net::IOBuffer* buf, int buf_len, | 645 virtual int Read(net::IOBuffer* buf, int buf_len, |
648 net::OldCompletionCallback* callback) OVERRIDE; | 646 net::OldCompletionCallback* callback) OVERRIDE; |
649 virtual int Read(net::IOBuffer* buf, int buf_len, | 647 virtual int Read(net::IOBuffer* buf, int buf_len, |
650 const net::CompletionCallback& callback) OVERRIDE; | 648 const net::CompletionCallback& callback) OVERRIDE; |
651 virtual int Write(net::IOBuffer* buf, int buf_len, | 649 virtual int Write(net::IOBuffer* buf, int buf_len, |
652 net::OldCompletionCallback* callback) OVERRIDE; | 650 net::OldCompletionCallback* callback) OVERRIDE; |
653 virtual int Write(net::IOBuffer* buf, int buf_len, | |
654 const net::CompletionCallback& callback) OVERRIDE; | |
655 | 651 |
656 // StreamSocket implementation. | 652 // StreamSocket implementation. |
657 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 653 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
658 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 654 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
659 virtual void Disconnect() OVERRIDE; | 655 virtual void Disconnect() OVERRIDE; |
660 virtual bool IsConnected() const OVERRIDE; | 656 virtual bool IsConnected() const OVERRIDE; |
661 virtual bool IsConnectedAndIdle() const OVERRIDE; | 657 virtual bool IsConnectedAndIdle() const OVERRIDE; |
662 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; | 658 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; |
663 virtual bool WasEverUsed() const OVERRIDE; | 659 virtual bool WasEverUsed() const OVERRIDE; |
664 virtual bool UsingTCPFastOpen() const OVERRIDE; | 660 virtual bool UsingTCPFastOpen() const OVERRIDE; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 net::DeterministicSocketData* data); | 696 net::DeterministicSocketData* data); |
701 virtual ~DeterministicMockTCPClientSocket(); | 697 virtual ~DeterministicMockTCPClientSocket(); |
702 | 698 |
703 bool write_pending() const { return write_pending_; } | 699 bool write_pending() const { return write_pending_; } |
704 bool read_pending() const { return read_pending_; } | 700 bool read_pending() const { return read_pending_; } |
705 | 701 |
706 void CompleteWrite(); | 702 void CompleteWrite(); |
707 int CompleteRead(); | 703 int CompleteRead(); |
708 | 704 |
709 // Socket implementation. | 705 // Socket implementation. |
| 706 virtual int Write(net::IOBuffer* buf, int buf_len, |
| 707 net::OldCompletionCallback* callback) OVERRIDE; |
710 virtual int Read(net::IOBuffer* buf, int buf_len, | 708 virtual int Read(net::IOBuffer* buf, int buf_len, |
711 net::OldCompletionCallback* callback) OVERRIDE; | 709 net::OldCompletionCallback* callback) OVERRIDE; |
712 virtual int Read(net::IOBuffer* buf, int buf_len, | 710 virtual int Read(net::IOBuffer* buf, int buf_len, |
713 const net::CompletionCallback& callback) OVERRIDE; | 711 const net::CompletionCallback& callback) OVERRIDE; |
714 virtual int Write(net::IOBuffer* buf, int buf_len, | |
715 net::OldCompletionCallback* callback) OVERRIDE; | |
716 virtual int Write(net::IOBuffer* buf, int buf_len, | |
717 const net::CompletionCallback& callback) OVERRIDE; | |
718 | 712 |
719 // StreamSocket implementation. | 713 // StreamSocket implementation. |
720 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 714 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
721 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 715 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
722 virtual void Disconnect() OVERRIDE; | 716 virtual void Disconnect() OVERRIDE; |
723 virtual bool IsConnected() const OVERRIDE; | 717 virtual bool IsConnected() const OVERRIDE; |
724 virtual bool IsConnectedAndIdle() const OVERRIDE; | 718 virtual bool IsConnectedAndIdle() const OVERRIDE; |
725 virtual bool WasEverUsed() const OVERRIDE; | 719 virtual bool WasEverUsed() const OVERRIDE; |
726 virtual bool UsingTCPFastOpen() const OVERRIDE; | 720 virtual bool UsingTCPFastOpen() const OVERRIDE; |
727 virtual int64 NumBytesRead() const OVERRIDE; | 721 virtual int64 NumBytesRead() const OVERRIDE; |
728 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 722 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
729 | 723 |
730 // AsyncSocket: | 724 // AsyncSocket: |
731 virtual void OnReadComplete(const MockRead& data) OVERRIDE; | 725 virtual void OnReadComplete(const MockRead& data) OVERRIDE; |
732 | 726 |
733 private: | 727 private: |
734 bool write_pending_; | 728 bool write_pending_; |
735 net::OldCompletionCallback* old_write_callback_; | 729 net::OldCompletionCallback* write_callback_; |
736 net::CompletionCallback write_callback_; | |
737 int write_result_; | 730 int write_result_; |
738 | 731 |
739 net::MockRead read_data_; | 732 net::MockRead read_data_; |
740 | 733 |
741 net::IOBuffer* read_buf_; | 734 net::IOBuffer* read_buf_; |
742 int read_buf_len_; | 735 int read_buf_len_; |
743 bool read_pending_; | 736 bool read_pending_; |
744 net::OldCompletionCallback* old_read_callback_; | 737 net::OldCompletionCallback* old_read_callback_; |
745 net::CompletionCallback read_callback_; | 738 net::CompletionCallback read_callback_; |
746 net::DeterministicSocketData* data_; | 739 net::DeterministicSocketData* data_; |
(...skipping 10 matching lines...) Expand all Loading... |
757 net::SSLSocketDataProvider* socket); | 750 net::SSLSocketDataProvider* socket); |
758 virtual ~MockSSLClientSocket(); | 751 virtual ~MockSSLClientSocket(); |
759 | 752 |
760 // Socket implementation. | 753 // Socket implementation. |
761 virtual int Read(net::IOBuffer* buf, int buf_len, | 754 virtual int Read(net::IOBuffer* buf, int buf_len, |
762 net::OldCompletionCallback* callback) OVERRIDE; | 755 net::OldCompletionCallback* callback) OVERRIDE; |
763 virtual int Read(net::IOBuffer* buf, int buf_len, | 756 virtual int Read(net::IOBuffer* buf, int buf_len, |
764 const net::CompletionCallback& callback) OVERRIDE; | 757 const net::CompletionCallback& callback) OVERRIDE; |
765 virtual int Write(net::IOBuffer* buf, int buf_len, | 758 virtual int Write(net::IOBuffer* buf, int buf_len, |
766 net::OldCompletionCallback* callback) OVERRIDE; | 759 net::OldCompletionCallback* callback) OVERRIDE; |
767 virtual int Write(net::IOBuffer* buf, int buf_len, | |
768 const net::CompletionCallback& callback) OVERRIDE; | |
769 | 760 |
770 // StreamSocket implementation. | 761 // StreamSocket implementation. |
771 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | 762 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; |
772 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 763 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
773 virtual void Disconnect() OVERRIDE; | 764 virtual void Disconnect() OVERRIDE; |
774 virtual bool IsConnected() const OVERRIDE; | 765 virtual bool IsConnected() const OVERRIDE; |
775 virtual bool WasEverUsed() const OVERRIDE; | 766 virtual bool WasEverUsed() const OVERRIDE; |
776 virtual bool UsingTCPFastOpen() const OVERRIDE; | 767 virtual bool UsingTCPFastOpen() const OVERRIDE; |
777 virtual int64 NumBytesRead() const OVERRIDE; | 768 virtual int64 NumBytesRead() const OVERRIDE; |
778 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 769 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
(...skipping 27 matching lines...) Expand all Loading... |
806 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log); | 797 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log); |
807 virtual ~MockUDPClientSocket(); | 798 virtual ~MockUDPClientSocket(); |
808 | 799 |
809 // Socket implementation. | 800 // Socket implementation. |
810 virtual int Read(net::IOBuffer* buf, int buf_len, | 801 virtual int Read(net::IOBuffer* buf, int buf_len, |
811 net::OldCompletionCallback* callback) OVERRIDE; | 802 net::OldCompletionCallback* callback) OVERRIDE; |
812 virtual int Read(net::IOBuffer* buf, int buf_len, | 803 virtual int Read(net::IOBuffer* buf, int buf_len, |
813 const net::CompletionCallback& callback) OVERRIDE; | 804 const net::CompletionCallback& callback) OVERRIDE; |
814 virtual int Write(net::IOBuffer* buf, int buf_len, | 805 virtual int Write(net::IOBuffer* buf, int buf_len, |
815 net::OldCompletionCallback* callback) OVERRIDE; | 806 net::OldCompletionCallback* callback) OVERRIDE; |
816 virtual int Write(net::IOBuffer* buf, int buf_len, | |
817 const net::CompletionCallback& callback) OVERRIDE; | |
818 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 807 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
819 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 808 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
820 | 809 |
821 // DatagramSocket implementation. | 810 // DatagramSocket implementation. |
822 virtual void Close() OVERRIDE; | 811 virtual void Close() OVERRIDE; |
823 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; | 812 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; |
824 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | 813 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
825 virtual const BoundNetLog& NetLog() const OVERRIDE; | 814 virtual const BoundNetLog& NetLog() const OVERRIDE; |
826 | 815 |
827 // DatagramClientSocket implementation. | 816 // DatagramClientSocket implementation. |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 | 1061 |
1073 extern const char kSOCKS5OkRequest[]; | 1062 extern const char kSOCKS5OkRequest[]; |
1074 extern const int kSOCKS5OkRequestLength; | 1063 extern const int kSOCKS5OkRequestLength; |
1075 | 1064 |
1076 extern const char kSOCKS5OkResponse[]; | 1065 extern const char kSOCKS5OkResponse[]; |
1077 extern const int kSOCKS5OkResponseLength; | 1066 extern const int kSOCKS5OkResponseLength; |
1078 | 1067 |
1079 } // namespace net | 1068 } // namespace net |
1080 | 1069 |
1081 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1070 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |