Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Side by Side Diff: net/socket/socket_test_util.h

Issue 8831001: base::Bind: Convert Socket::Write. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix alignment. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/socket.h ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
595 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 597 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
596 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 598 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
597 599
598 // StreamSocket implementation. 600 // StreamSocket implementation.
599 virtual int Connect(net::OldCompletionCallback* callback) = 0; 601 virtual int Connect(net::OldCompletionCallback* callback) = 0;
600 virtual int Connect(const net::CompletionCallback& callback) = 0; 602 virtual int Connect(const net::CompletionCallback& callback) = 0;
601 virtual void Disconnect() OVERRIDE; 603 virtual void Disconnect() OVERRIDE;
602 virtual bool IsConnected() const OVERRIDE; 604 virtual bool IsConnected() const OVERRIDE;
603 virtual bool IsConnectedAndIdle() const OVERRIDE; 605 virtual bool IsConnectedAndIdle() const OVERRIDE;
604 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; 606 virtual int GetPeerAddress(AddressList* address) const OVERRIDE;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 643
642 net::AddressList addresses() const { return addresses_; } 644 net::AddressList addresses() const { return addresses_; }
643 645
644 // Socket implementation. 646 // Socket implementation.
645 virtual int Read(net::IOBuffer* buf, int buf_len, 647 virtual int Read(net::IOBuffer* buf, int buf_len,
646 net::OldCompletionCallback* callback) OVERRIDE; 648 net::OldCompletionCallback* callback) OVERRIDE;
647 virtual int Read(net::IOBuffer* buf, int buf_len, 649 virtual int Read(net::IOBuffer* buf, int buf_len,
648 const net::CompletionCallback& callback) OVERRIDE; 650 const net::CompletionCallback& callback) OVERRIDE;
649 virtual int Write(net::IOBuffer* buf, int buf_len, 651 virtual int Write(net::IOBuffer* buf, int buf_len,
650 net::OldCompletionCallback* callback) OVERRIDE; 652 net::OldCompletionCallback* callback) OVERRIDE;
653 virtual int Write(net::IOBuffer* buf, int buf_len,
654 const net::CompletionCallback& callback) OVERRIDE;
651 655
652 // StreamSocket implementation. 656 // StreamSocket implementation.
653 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; 657 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
654 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; 658 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
655 virtual void Disconnect() OVERRIDE; 659 virtual void Disconnect() OVERRIDE;
656 virtual bool IsConnected() const OVERRIDE; 660 virtual bool IsConnected() const OVERRIDE;
657 virtual bool IsConnectedAndIdle() const OVERRIDE; 661 virtual bool IsConnectedAndIdle() const OVERRIDE;
658 virtual int GetPeerAddress(AddressList* address) const OVERRIDE; 662 virtual int GetPeerAddress(AddressList* address) const OVERRIDE;
659 virtual bool WasEverUsed() const OVERRIDE; 663 virtual bool WasEverUsed() const OVERRIDE;
660 virtual bool UsingTCPFastOpen() const OVERRIDE; 664 virtual bool UsingTCPFastOpen() const OVERRIDE;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 net::DeterministicSocketData* data); 700 net::DeterministicSocketData* data);
697 virtual ~DeterministicMockTCPClientSocket(); 701 virtual ~DeterministicMockTCPClientSocket();
698 702
699 bool write_pending() const { return write_pending_; } 703 bool write_pending() const { return write_pending_; }
700 bool read_pending() const { return read_pending_; } 704 bool read_pending() const { return read_pending_; }
701 705
702 void CompleteWrite(); 706 void CompleteWrite();
703 int CompleteRead(); 707 int CompleteRead();
704 708
705 // Socket implementation. 709 // Socket implementation.
706 virtual int Write(net::IOBuffer* buf, int buf_len,
707 net::OldCompletionCallback* callback) OVERRIDE;
708 virtual int Read(net::IOBuffer* buf, int buf_len, 710 virtual int Read(net::IOBuffer* buf, int buf_len,
709 net::OldCompletionCallback* callback) OVERRIDE; 711 net::OldCompletionCallback* callback) OVERRIDE;
710 virtual int Read(net::IOBuffer* buf, int buf_len, 712 virtual int Read(net::IOBuffer* buf, int buf_len,
711 const net::CompletionCallback& callback) OVERRIDE; 713 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;
712 718
713 // StreamSocket implementation. 719 // StreamSocket implementation.
714 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; 720 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
715 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; 721 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
716 virtual void Disconnect() OVERRIDE; 722 virtual void Disconnect() OVERRIDE;
717 virtual bool IsConnected() const OVERRIDE; 723 virtual bool IsConnected() const OVERRIDE;
718 virtual bool IsConnectedAndIdle() const OVERRIDE; 724 virtual bool IsConnectedAndIdle() const OVERRIDE;
719 virtual bool WasEverUsed() const OVERRIDE; 725 virtual bool WasEverUsed() const OVERRIDE;
720 virtual bool UsingTCPFastOpen() const OVERRIDE; 726 virtual bool UsingTCPFastOpen() const OVERRIDE;
721 virtual int64 NumBytesRead() const OVERRIDE; 727 virtual int64 NumBytesRead() const OVERRIDE;
722 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; 728 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
723 729
724 // AsyncSocket: 730 // AsyncSocket:
725 virtual void OnReadComplete(const MockRead& data) OVERRIDE; 731 virtual void OnReadComplete(const MockRead& data) OVERRIDE;
726 732
727 private: 733 private:
728 bool write_pending_; 734 bool write_pending_;
729 net::OldCompletionCallback* write_callback_; 735 net::OldCompletionCallback* old_write_callback_;
736 net::CompletionCallback write_callback_;
730 int write_result_; 737 int write_result_;
731 738
732 net::MockRead read_data_; 739 net::MockRead read_data_;
733 740
734 net::IOBuffer* read_buf_; 741 net::IOBuffer* read_buf_;
735 int read_buf_len_; 742 int read_buf_len_;
736 bool read_pending_; 743 bool read_pending_;
737 net::OldCompletionCallback* old_read_callback_; 744 net::OldCompletionCallback* old_read_callback_;
738 net::CompletionCallback read_callback_; 745 net::CompletionCallback read_callback_;
739 net::DeterministicSocketData* data_; 746 net::DeterministicSocketData* data_;
(...skipping 10 matching lines...) Expand all
750 net::SSLSocketDataProvider* socket); 757 net::SSLSocketDataProvider* socket);
751 virtual ~MockSSLClientSocket(); 758 virtual ~MockSSLClientSocket();
752 759
753 // Socket implementation. 760 // Socket implementation.
754 virtual int Read(net::IOBuffer* buf, int buf_len, 761 virtual int Read(net::IOBuffer* buf, int buf_len,
755 net::OldCompletionCallback* callback) OVERRIDE; 762 net::OldCompletionCallback* callback) OVERRIDE;
756 virtual int Read(net::IOBuffer* buf, int buf_len, 763 virtual int Read(net::IOBuffer* buf, int buf_len,
757 const net::CompletionCallback& callback) OVERRIDE; 764 const net::CompletionCallback& callback) OVERRIDE;
758 virtual int Write(net::IOBuffer* buf, int buf_len, 765 virtual int Write(net::IOBuffer* buf, int buf_len,
759 net::OldCompletionCallback* callback) OVERRIDE; 766 net::OldCompletionCallback* callback) OVERRIDE;
767 virtual int Write(net::IOBuffer* buf, int buf_len,
768 const net::CompletionCallback& callback) OVERRIDE;
760 769
761 // StreamSocket implementation. 770 // StreamSocket implementation.
762 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; 771 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
763 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; 772 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
764 virtual void Disconnect() OVERRIDE; 773 virtual void Disconnect() OVERRIDE;
765 virtual bool IsConnected() const OVERRIDE; 774 virtual bool IsConnected() const OVERRIDE;
766 virtual bool WasEverUsed() const OVERRIDE; 775 virtual bool WasEverUsed() const OVERRIDE;
767 virtual bool UsingTCPFastOpen() const OVERRIDE; 776 virtual bool UsingTCPFastOpen() const OVERRIDE;
768 virtual int64 NumBytesRead() const OVERRIDE; 777 virtual int64 NumBytesRead() const OVERRIDE;
769 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; 778 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
(...skipping 27 matching lines...) Expand all
797 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log); 806 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log);
798 virtual ~MockUDPClientSocket(); 807 virtual ~MockUDPClientSocket();
799 808
800 // Socket implementation. 809 // Socket implementation.
801 virtual int Read(net::IOBuffer* buf, int buf_len, 810 virtual int Read(net::IOBuffer* buf, int buf_len,
802 net::OldCompletionCallback* callback) OVERRIDE; 811 net::OldCompletionCallback* callback) OVERRIDE;
803 virtual int Read(net::IOBuffer* buf, int buf_len, 812 virtual int Read(net::IOBuffer* buf, int buf_len,
804 const net::CompletionCallback& callback) OVERRIDE; 813 const net::CompletionCallback& callback) OVERRIDE;
805 virtual int Write(net::IOBuffer* buf, int buf_len, 814 virtual int Write(net::IOBuffer* buf, int buf_len,
806 net::OldCompletionCallback* callback) OVERRIDE; 815 net::OldCompletionCallback* callback) OVERRIDE;
816 virtual int Write(net::IOBuffer* buf, int buf_len,
817 const net::CompletionCallback& callback) OVERRIDE;
807 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 818 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
808 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 819 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
809 820
810 // DatagramSocket implementation. 821 // DatagramSocket implementation.
811 virtual void Close() OVERRIDE; 822 virtual void Close() OVERRIDE;
812 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; 823 virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
813 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; 824 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
814 virtual const BoundNetLog& NetLog() const OVERRIDE; 825 virtual const BoundNetLog& NetLog() const OVERRIDE;
815 826
816 // DatagramClientSocket implementation. 827 // DatagramClientSocket implementation.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 1072
1062 extern const char kSOCKS5OkRequest[]; 1073 extern const char kSOCKS5OkRequest[];
1063 extern const int kSOCKS5OkRequestLength; 1074 extern const int kSOCKS5OkRequestLength;
1064 1075
1065 extern const char kSOCKS5OkResponse[]; 1076 extern const char kSOCKS5OkResponse[];
1066 extern const int kSOCKS5OkResponseLength; 1077 extern const int kSOCKS5OkResponseLength;
1067 1078
1068 } // namespace net 1079 } // namespace net
1069 1080
1070 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1081 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/socket/socket.h ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698