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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cstring> | 10 #include <cstring> |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 int SetSendBufferSize(int32 size) override; | 818 int SetSendBufferSize(int32 size) override; |
819 | 819 |
820 // DatagramSocket implementation. | 820 // DatagramSocket implementation. |
821 void Close() override; | 821 void Close() override; |
822 int GetPeerAddress(IPEndPoint* address) const override; | 822 int GetPeerAddress(IPEndPoint* address) const override; |
823 int GetLocalAddress(IPEndPoint* address) const override; | 823 int GetLocalAddress(IPEndPoint* address) const override; |
824 const BoundNetLog& NetLog() const override; | 824 const BoundNetLog& NetLog() const override; |
825 | 825 |
826 // DatagramClientSocket implementation. | 826 // DatagramClientSocket implementation. |
827 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; | 827 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; |
| 828 int BindToDefaultNetwork() override; |
| 829 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() override; |
828 int Connect(const IPEndPoint& address) override; | 830 int Connect(const IPEndPoint& address) override; |
829 | 831 |
830 void set_source_port(uint16 port) { source_port_ = port; } | 832 void set_source_port(uint16 port) { source_port_ = port; } |
831 | 833 |
832 private: | 834 private: |
833 bool connected_; | 835 bool connected_; |
834 IPEndPoint peer_address_; | 836 IPEndPoint peer_address_; |
835 DeterministicSocketHelper helper_; | 837 DeterministicSocketHelper helper_; |
836 uint16 source_port_; // Ephemeral source port. | 838 uint16 source_port_; // Ephemeral source port. |
837 | 839 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 int SetSendBufferSize(int32 size) override; | 943 int SetSendBufferSize(int32 size) override; |
942 | 944 |
943 // DatagramSocket implementation. | 945 // DatagramSocket implementation. |
944 void Close() override; | 946 void Close() override; |
945 int GetPeerAddress(IPEndPoint* address) const override; | 947 int GetPeerAddress(IPEndPoint* address) const override; |
946 int GetLocalAddress(IPEndPoint* address) const override; | 948 int GetLocalAddress(IPEndPoint* address) const override; |
947 const BoundNetLog& NetLog() const override; | 949 const BoundNetLog& NetLog() const override; |
948 | 950 |
949 // DatagramClientSocket implementation. | 951 // DatagramClientSocket implementation. |
950 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; | 952 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; |
| 953 int BindToDefaultNetwork() override; |
| 954 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() override; |
951 int Connect(const IPEndPoint& address) override; | 955 int Connect(const IPEndPoint& address) override; |
952 | 956 |
953 // AsyncSocket implementation. | 957 // AsyncSocket implementation. |
954 void OnReadComplete(const MockRead& data) override; | 958 void OnReadComplete(const MockRead& data) override; |
955 void OnWriteComplete(int rv) override; | 959 void OnWriteComplete(int rv) override; |
956 void OnConnectComplete(const MockConnect& data) override; | 960 void OnConnectComplete(const MockConnect& data) override; |
957 | 961 |
958 void set_source_port(uint16 port) { source_port_ = port;} | 962 void set_source_port(uint16 port) { source_port_ = port;} |
959 | 963 |
960 private: | 964 private: |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 | 1252 |
1249 // Helper function to get the total data size of the MockReads in |reads|. | 1253 // Helper function to get the total data size of the MockReads in |reads|. |
1250 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 1254 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
1251 | 1255 |
1252 // Helper function to get the total data size of the MockWrites in |writes|. | 1256 // Helper function to get the total data size of the MockWrites in |writes|. |
1253 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1257 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
1254 | 1258 |
1255 } // namespace net | 1259 } // namespace net |
1256 | 1260 |
1257 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1261 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |