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

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

Issue 10704166: Change DeterministicMockTCPClientSocket to set the peer address from the connect data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix sleevi's comment Created 8 years, 5 months 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 | « no previous file | 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) 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 #pragma once 7 #pragma once
8 8
9 #include <cstring> 9 #include <cstring>
10 #include <deque> 10 #include <deque>
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // TCPClientSocket. 668 // TCPClientSocket.
669 bool peer_closed_connection_; 669 bool peer_closed_connection_;
670 670
671 // While an asynchronous IO is pending, we save our user-buffer state. 671 // While an asynchronous IO is pending, we save our user-buffer state.
672 IOBuffer* pending_buf_; 672 IOBuffer* pending_buf_;
673 int pending_buf_len_; 673 int pending_buf_len_;
674 CompletionCallback pending_callback_; 674 CompletionCallback pending_callback_;
675 bool was_used_to_convey_data_; 675 bool was_used_to_convey_data_;
676 }; 676 };
677 677
678 class DeterministicMockTCPClientSocket : public MockClientSocket, 678 class DeterministicMockTCPClientSocket
679 public AsyncSocket, 679 : public MockClientSocket,
680 public base::SupportsWeakPtr<DeterministicMockTCPClientSocket> { 680 public AsyncSocket,
681 public base::SupportsWeakPtr<DeterministicMockTCPClientSocket> {
681 public: 682 public:
682 DeterministicMockTCPClientSocket(net::NetLog* net_log, 683 DeterministicMockTCPClientSocket(net::NetLog* net_log,
683 DeterministicSocketData* data); 684 DeterministicSocketData* data);
684 virtual ~DeterministicMockTCPClientSocket(); 685 virtual ~DeterministicMockTCPClientSocket();
685 686
686 bool write_pending() const { return write_pending_; } 687 bool write_pending() const { return write_pending_; }
687 bool read_pending() const { return read_pending_; } 688 bool read_pending() const { return read_pending_; }
688 689
689 void CompleteWrite(); 690 void CompleteWrite();
690 int CompleteRead(); 691 int CompleteRead();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 int rv); 775 int rv);
775 776
776 scoped_ptr<ClientSocketHandle> transport_; 777 scoped_ptr<ClientSocketHandle> transport_;
777 SSLSocketDataProvider* data_; 778 SSLSocketDataProvider* data_;
778 bool is_npn_state_set_; 779 bool is_npn_state_set_;
779 bool new_npn_value_; 780 bool new_npn_value_;
780 bool is_protocol_negotiated_set_; 781 bool is_protocol_negotiated_set_;
781 NextProto protocol_negotiated_; 782 NextProto protocol_negotiated_;
782 }; 783 };
783 784
784 class MockUDPClientSocket : public DatagramClientSocket, 785 class MockUDPClientSocket
785 public AsyncSocket { 786 : public DatagramClientSocket,
787 public AsyncSocket {
786 public: 788 public:
787 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log); 789 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log);
788 virtual ~MockUDPClientSocket(); 790 virtual ~MockUDPClientSocket();
789 791
790 // Socket implementation. 792 // Socket implementation.
791 virtual int Read(IOBuffer* buf, int buf_len, 793 virtual int Read(IOBuffer* buf, int buf_len,
792 const CompletionCallback& callback) OVERRIDE; 794 const CompletionCallback& callback) OVERRIDE;
793 virtual int Write(IOBuffer* buf, int buf_len, 795 virtual int Write(IOBuffer* buf, int buf_len,
794 const CompletionCallback& callback) OVERRIDE; 796 const CompletionCallback& callback) OVERRIDE;
795 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 797 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1048
1047 extern const char kSOCKS5OkRequest[]; 1049 extern const char kSOCKS5OkRequest[];
1048 extern const int kSOCKS5OkRequestLength; 1050 extern const int kSOCKS5OkRequestLength;
1049 1051
1050 extern const char kSOCKS5OkResponse[]; 1052 extern const char kSOCKS5OkResponse[];
1051 extern const int kSOCKS5OkResponseLength; 1053 extern const int kSOCKS5OkResponseLength;
1052 1054
1053 } // namespace net 1055 } // namespace net
1054 1056
1055 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1057 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698