| 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 | 854 |
| 855 // DatagramSocket implementation. | 855 // DatagramSocket implementation. |
| 856 void Close() override; | 856 void Close() override; |
| 857 int GetPeerAddress(IPEndPoint* address) const override; | 857 int GetPeerAddress(IPEndPoint* address) const override; |
| 858 int GetLocalAddress(IPEndPoint* address) const override; | 858 int GetLocalAddress(IPEndPoint* address) const override; |
| 859 const BoundNetLog& NetLog() const override; | 859 const BoundNetLog& NetLog() const override; |
| 860 | 860 |
| 861 // DatagramClientSocket implementation. | 861 // DatagramClientSocket implementation. |
| 862 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; | 862 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; |
| 863 int BindToDefaultNetwork() override; | 863 int BindToDefaultNetwork() override; |
| 864 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() override; | 864 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() const override; |
| 865 int Connect(const IPEndPoint& address) override; | 865 int Connect(const IPEndPoint& address) override; |
| 866 | 866 |
| 867 void set_source_port(uint16 port) { source_port_ = port; } | 867 void set_source_port(uint16 port) { source_port_ = port; } |
| 868 | 868 |
| 869 private: | 869 private: |
| 870 bool connected_; | 870 bool connected_; |
| 871 IPEndPoint peer_address_; | 871 IPEndPoint peer_address_; |
| 872 DeterministicSocketHelper helper_; | 872 DeterministicSocketHelper helper_; |
| 873 uint16 source_port_; // Ephemeral source port. | 873 uint16 source_port_; // Ephemeral source port. |
| 874 | 874 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 | 984 |
| 985 // DatagramSocket implementation. | 985 // DatagramSocket implementation. |
| 986 void Close() override; | 986 void Close() override; |
| 987 int GetPeerAddress(IPEndPoint* address) const override; | 987 int GetPeerAddress(IPEndPoint* address) const override; |
| 988 int GetLocalAddress(IPEndPoint* address) const override; | 988 int GetLocalAddress(IPEndPoint* address) const override; |
| 989 const BoundNetLog& NetLog() const override; | 989 const BoundNetLog& NetLog() const override; |
| 990 | 990 |
| 991 // DatagramClientSocket implementation. | 991 // DatagramClientSocket implementation. |
| 992 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; | 992 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; |
| 993 int BindToDefaultNetwork() override; | 993 int BindToDefaultNetwork() override; |
| 994 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() override; | 994 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() const override; |
| 995 int Connect(const IPEndPoint& address) override; | 995 int Connect(const IPEndPoint& address) override; |
| 996 | 996 |
| 997 // AsyncSocket implementation. | 997 // AsyncSocket implementation. |
| 998 void OnReadComplete(const MockRead& data) override; | 998 void OnReadComplete(const MockRead& data) override; |
| 999 void OnWriteComplete(int rv) override; | 999 void OnWriteComplete(int rv) override; |
| 1000 void OnConnectComplete(const MockConnect& data) override; | 1000 void OnConnectComplete(const MockConnect& data) override; |
| 1001 void OnDataProviderDestroyed() override; | 1001 void OnDataProviderDestroyed() override; |
| 1002 | 1002 |
| 1003 void set_source_port(uint16 port) { source_port_ = port;} | 1003 void set_source_port(uint16 port) { source_port_ = port;} |
| 1004 | 1004 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 | 1293 |
| 1294 // Helper function to get the total data size of the MockReads in |reads|. | 1294 // Helper function to get the total data size of the MockReads in |reads|. |
| 1295 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 1295 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
| 1296 | 1296 |
| 1297 // Helper function to get the total data size of the MockWrites in |writes|. | 1297 // Helper function to get the total data size of the MockWrites in |writes|. |
| 1298 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1298 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
| 1299 | 1299 |
| 1300 } // namespace net | 1300 } // namespace net |
| 1301 | 1301 |
| 1302 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1302 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |