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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/socket/server_socket.cc ('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) 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 int GetLocalAddress(IPEndPoint* address) const override; 874 int GetLocalAddress(IPEndPoint* address) const override;
875 const BoundNetLog& NetLog() const override; 875 const BoundNetLog& NetLog() const override;
876 876
877 // DatagramClientSocket implementation. 877 // DatagramClientSocket implementation.
878 int Connect(const IPEndPoint& address) override; 878 int Connect(const IPEndPoint& address) override;
879 879
880 // AsyncSocket implementation. 880 // AsyncSocket implementation.
881 void OnReadComplete(const MockRead& data) override; 881 void OnReadComplete(const MockRead& data) override;
882 void OnConnectComplete(const MockConnect& data) override; 882 void OnConnectComplete(const MockConnect& data) override;
883 883
884 void set_source_port(int port) { source_port_ = port; } 884 void set_source_port(uint16 port) { source_port_ = port; }
885 885
886 private: 886 private:
887 bool connected_; 887 bool connected_;
888 IPEndPoint peer_address_; 888 IPEndPoint peer_address_;
889 DeterministicSocketHelper helper_; 889 DeterministicSocketHelper helper_;
890 int source_port_; // Ephemeral source port. 890 uint16 source_port_; // Ephemeral source port.
891 891
892 DISALLOW_COPY_AND_ASSIGN(DeterministicMockUDPClientSocket); 892 DISALLOW_COPY_AND_ASSIGN(DeterministicMockUDPClientSocket);
893 }; 893 };
894 894
895 // Mock TCP socket to be used in conjunction with DeterministicSocketData. 895 // Mock TCP socket to be used in conjunction with DeterministicSocketData.
896 class DeterministicMockTCPClientSocket 896 class DeterministicMockTCPClientSocket
897 : public MockClientSocket, 897 : public MockClientSocket,
898 public AsyncSocket, 898 public AsyncSocket,
899 public DeterministicSocketData::Delegate, 899 public DeterministicSocketData::Delegate,
900 public base::SupportsWeakPtr<DeterministicMockTCPClientSocket> { 900 public base::SupportsWeakPtr<DeterministicMockTCPClientSocket> {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 int GetLocalAddress(IPEndPoint* address) const override; 1044 int GetLocalAddress(IPEndPoint* address) const override;
1045 const BoundNetLog& NetLog() const override; 1045 const BoundNetLog& NetLog() const override;
1046 1046
1047 // DatagramClientSocket implementation. 1047 // DatagramClientSocket implementation.
1048 int Connect(const IPEndPoint& address) override; 1048 int Connect(const IPEndPoint& address) override;
1049 1049
1050 // AsyncSocket implementation. 1050 // AsyncSocket implementation.
1051 void OnReadComplete(const MockRead& data) override; 1051 void OnReadComplete(const MockRead& data) override;
1052 void OnConnectComplete(const MockConnect& data) override; 1052 void OnConnectComplete(const MockConnect& data) override;
1053 1053
1054 void set_source_port(int port) { source_port_ = port;} 1054 void set_source_port(uint16 port) { source_port_ = port;}
1055 1055
1056 private: 1056 private:
1057 int CompleteRead(); 1057 int CompleteRead();
1058 1058
1059 void RunCallbackAsync(const CompletionCallback& callback, int result); 1059 void RunCallbackAsync(const CompletionCallback& callback, int result);
1060 void RunCallback(const CompletionCallback& callback, int result); 1060 void RunCallback(const CompletionCallback& callback, int result);
1061 1061
1062 bool connected_; 1062 bool connected_;
1063 SocketDataProvider* data_; 1063 SocketDataProvider* data_;
1064 int read_offset_; 1064 int read_offset_;
1065 MockRead read_data_; 1065 MockRead read_data_;
1066 bool need_read_data_; 1066 bool need_read_data_;
1067 int source_port_; // Ephemeral source port. 1067 uint16 source_port_; // Ephemeral source port.
1068 1068
1069 // Address of the "remote" peer we're connected to. 1069 // Address of the "remote" peer we're connected to.
1070 IPEndPoint peer_addr_; 1070 IPEndPoint peer_addr_;
1071 1071
1072 // While an asynchronous IO is pending, we save our user-buffer state. 1072 // While an asynchronous IO is pending, we save our user-buffer state.
1073 scoped_refptr<IOBuffer> pending_buf_; 1073 scoped_refptr<IOBuffer> pending_buf_;
1074 int pending_buf_len_; 1074 int pending_buf_len_;
1075 CompletionCallback pending_callback_; 1075 CompletionCallback pending_callback_;
1076 1076
1077 BoundNetLog net_log_; 1077 BoundNetLog net_log_;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1327
1328 extern const char kSOCKS5OkRequest[]; 1328 extern const char kSOCKS5OkRequest[];
1329 extern const int kSOCKS5OkRequestLength; 1329 extern const int kSOCKS5OkRequestLength;
1330 1330
1331 extern const char kSOCKS5OkResponse[]; 1331 extern const char kSOCKS5OkResponse[];
1332 extern const int kSOCKS5OkResponseLength; 1332 extern const int kSOCKS5OkResponseLength;
1333 1333
1334 } // namespace net 1334 } // namespace net
1335 1335
1336 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1336 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/socket/server_socket.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698