Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 #include "net/ssl/ssl_config_service.h" | 39 #include "net/ssl/ssl_config_service.h" |
| 40 #include "net/udp/datagram_client_socket.h" | 40 #include "net/udp/datagram_client_socket.h" |
| 41 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 42 | 42 |
| 43 namespace base { | 43 namespace base { |
| 44 class RunLoop; | 44 class RunLoop; |
| 45 } | 45 } |
| 46 | 46 |
| 47 namespace net { | 47 namespace net { |
| 48 | 48 |
| 49 NET_EXPORT_PRIVATE extern const NetworkChangeNotifier::NetworkHandle | |
|
Ryan Hamilton
2016/01/12 20:13:01
extern const is the magic? I hate C++
Jana
2016/01/12 22:04:33
I think the extern was missing... I added the cons
| |
| 50 kDefaultNetworkForTests; | |
| 51 NET_EXPORT_PRIVATE extern const NetworkChangeNotifier::NetworkHandle | |
| 52 kNewNetworkForTests; | |
| 53 | |
| 49 enum { | 54 enum { |
| 50 // A private network error code used by the socket test utility classes. | 55 // A private network error code used by the socket test utility classes. |
| 51 // If the |result| member of a MockRead is | 56 // If the |result| member of a MockRead is |
| 52 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a | 57 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a |
| 53 // marker that indicates the peer will close the connection after the next | 58 // marker that indicates the peer will close the connection after the next |
| 54 // MockRead. The other members of that MockRead are ignored. | 59 // MockRead. The other members of that MockRead are ignored. |
| 55 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, | 60 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, |
| 56 }; | 61 }; |
| 57 | 62 |
| 58 class AsyncSocket; | 63 class AsyncSocket; |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 bool connected_; | 762 bool connected_; |
| 758 SocketDataProvider* data_; | 763 SocketDataProvider* data_; |
| 759 int read_offset_; | 764 int read_offset_; |
| 760 MockRead read_data_; | 765 MockRead read_data_; |
| 761 bool need_read_data_; | 766 bool need_read_data_; |
| 762 uint16_t source_port_; // Ephemeral source port. | 767 uint16_t source_port_; // Ephemeral source port. |
| 763 | 768 |
| 764 // Address of the "remote" peer we're connected to. | 769 // Address of the "remote" peer we're connected to. |
| 765 IPEndPoint peer_addr_; | 770 IPEndPoint peer_addr_; |
| 766 | 771 |
| 772 // Network that the socket is bound to. | |
| 773 NetworkChangeNotifier::NetworkHandle network_; | |
| 774 | |
| 767 // While an asynchronous IO is pending, we save our user-buffer state. | 775 // While an asynchronous IO is pending, we save our user-buffer state. |
| 768 scoped_refptr<IOBuffer> pending_read_buf_; | 776 scoped_refptr<IOBuffer> pending_read_buf_; |
| 769 int pending_read_buf_len_; | 777 int pending_read_buf_len_; |
| 770 CompletionCallback pending_read_callback_; | 778 CompletionCallback pending_read_callback_; |
| 771 CompletionCallback pending_write_callback_; | 779 CompletionCallback pending_write_callback_; |
| 772 | 780 |
| 773 BoundNetLog net_log_; | 781 BoundNetLog net_log_; |
| 774 | 782 |
| 775 base::WeakPtrFactory<MockUDPClientSocket> weak_factory_; | 783 base::WeakPtrFactory<MockUDPClientSocket> weak_factory_; |
| 776 | 784 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 987 | 995 |
| 988 // Helper function to get the total data size of the MockReads in |reads|. | 996 // Helper function to get the total data size of the MockReads in |reads|. |
| 989 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 997 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
| 990 | 998 |
| 991 // Helper function to get the total data size of the MockWrites in |writes|. | 999 // Helper function to get the total data size of the MockWrites in |writes|. |
| 992 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1000 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
| 993 | 1001 |
| 994 } // namespace net | 1002 } // namespace net |
| 995 | 1003 |
| 996 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1004 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |