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 NetworkChangeNotifier::NetworkHandle kDefaultNetworkForTests = 1; | |
50 NET_EXPORT NetworkChangeNotifier::NetworkHandle kNewNetworkForTests = 2; | |
Ryan Hamilton
2016/01/08 05:01:06
I suspect you want/need const for these.
| |
51 | |
49 enum { | 52 enum { |
50 // A private network error code used by the socket test utility classes. | 53 // A private network error code used by the socket test utility classes. |
51 // If the |result| member of a MockRead is | 54 // If the |result| member of a MockRead is |
52 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a | 55 // 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 | 56 // marker that indicates the peer will close the connection after the next |
54 // MockRead. The other members of that MockRead are ignored. | 57 // MockRead. The other members of that MockRead are ignored. |
55 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, | 58 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, |
56 }; | 59 }; |
57 | 60 |
58 class AsyncSocket; | 61 class AsyncSocket; |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 bool connected_; | 760 bool connected_; |
758 SocketDataProvider* data_; | 761 SocketDataProvider* data_; |
759 int read_offset_; | 762 int read_offset_; |
760 MockRead read_data_; | 763 MockRead read_data_; |
761 bool need_read_data_; | 764 bool need_read_data_; |
762 uint16_t source_port_; // Ephemeral source port. | 765 uint16_t source_port_; // Ephemeral source port. |
763 | 766 |
764 // Address of the "remote" peer we're connected to. | 767 // Address of the "remote" peer we're connected to. |
765 IPEndPoint peer_addr_; | 768 IPEndPoint peer_addr_; |
766 | 769 |
770 // Network that the socket is bound to. | |
771 NetworkChangeNotifier::NetworkHandle network_; | |
772 | |
767 // While an asynchronous IO is pending, we save our user-buffer state. | 773 // While an asynchronous IO is pending, we save our user-buffer state. |
768 scoped_refptr<IOBuffer> pending_read_buf_; | 774 scoped_refptr<IOBuffer> pending_read_buf_; |
769 int pending_read_buf_len_; | 775 int pending_read_buf_len_; |
770 CompletionCallback pending_read_callback_; | 776 CompletionCallback pending_read_callback_; |
771 CompletionCallback pending_write_callback_; | 777 CompletionCallback pending_write_callback_; |
772 | 778 |
773 BoundNetLog net_log_; | 779 BoundNetLog net_log_; |
774 | 780 |
775 base::WeakPtrFactory<MockUDPClientSocket> weak_factory_; | 781 base::WeakPtrFactory<MockUDPClientSocket> weak_factory_; |
776 | 782 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
987 | 993 |
988 // Helper function to get the total data size of the MockReads in |reads|. | 994 // Helper function to get the total data size of the MockReads in |reads|. |
989 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 995 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
990 | 996 |
991 // Helper function to get the total data size of the MockWrites in |writes|. | 997 // Helper function to get the total data size of the MockWrites in |writes|. |
992 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 998 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
993 | 999 |
994 } // namespace net | 1000 } // namespace net |
995 | 1001 |
996 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1002 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |