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 11 matching lines...) Expand all Loading... |
22 #include "base/memory/scoped_vector.h" | 22 #include "base/memory/scoped_vector.h" |
23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
24 #include "base/strings/string16.h" | 24 #include "base/strings/string16.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "net/base/address_list.h" | 26 #include "net/base/address_list.h" |
27 #include "net/base/io_buffer.h" | 27 #include "net/base/io_buffer.h" |
28 #include "net/base/net_errors.h" | 28 #include "net/base/net_errors.h" |
29 #include "net/base/test_completion_callback.h" | 29 #include "net/base/test_completion_callback.h" |
30 #include "net/http/http_auth_controller.h" | 30 #include "net/http/http_auth_controller.h" |
31 #include "net/http/http_proxy_client_socket_pool.h" | 31 #include "net/http/http_proxy_client_socket_pool.h" |
32 #include "net/log/net_log.h" | 32 #include "net/log/net_log_with_source.h" |
33 #include "net/socket/client_socket_factory.h" | 33 #include "net/socket/client_socket_factory.h" |
34 #include "net/socket/client_socket_handle.h" | 34 #include "net/socket/client_socket_handle.h" |
35 #include "net/socket/connection_attempts.h" | 35 #include "net/socket/connection_attempts.h" |
36 #include "net/socket/socket_performance_watcher.h" | 36 #include "net/socket/socket_performance_watcher.h" |
37 #include "net/socket/socks_client_socket_pool.h" | 37 #include "net/socket/socks_client_socket_pool.h" |
38 #include "net/socket/ssl_client_socket.h" | 38 #include "net/socket/ssl_client_socket.h" |
39 #include "net/socket/ssl_client_socket_pool.h" | 39 #include "net/socket/ssl_client_socket_pool.h" |
40 #include "net/socket/transport_client_socket_pool.h" | 40 #include "net/socket/transport_client_socket_pool.h" |
41 #include "net/ssl/ssl_config_service.h" | 41 #include "net/ssl/ssl_config_service.h" |
42 #include "net/udp/datagram_client_socket.h" | 42 #include "net/udp/datagram_client_socket.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 43 #include "testing/gtest/include/gtest/gtest.h" |
44 | 44 |
45 namespace base { | 45 namespace base { |
46 class RunLoop; | 46 class RunLoop; |
47 } | 47 } |
48 | 48 |
49 namespace net { | 49 namespace net { |
50 | 50 |
| 51 class NetLog; |
| 52 |
51 const NetworkChangeNotifier::NetworkHandle kDefaultNetworkForTests = 1; | 53 const NetworkChangeNotifier::NetworkHandle kDefaultNetworkForTests = 1; |
52 const NetworkChangeNotifier::NetworkHandle kNewNetworkForTests = 2; | 54 const NetworkChangeNotifier::NetworkHandle kNewNetworkForTests = 2; |
53 | 55 |
54 enum { | 56 enum { |
55 // A private network error code used by the socket test utility classes. | 57 // A private network error code used by the socket test utility classes. |
56 // If the |result| member of a MockRead is | 58 // If the |result| member of a MockRead is |
57 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a | 59 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a |
58 // marker that indicates the peer will close the connection after the next | 60 // marker that indicates the peer will close the connection after the next |
59 // MockRead. The other members of that MockRead are ignored. | 61 // MockRead. The other members of that MockRead are ignored. |
60 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, | 62 ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 512 |
511 SocketDataProviderArray<SocketDataProvider>& mock_data() { | 513 SocketDataProviderArray<SocketDataProvider>& mock_data() { |
512 return mock_data_; | 514 return mock_data_; |
513 } | 515 } |
514 | 516 |
515 // ClientSocketFactory | 517 // ClientSocketFactory |
516 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 518 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
517 DatagramSocket::BindType bind_type, | 519 DatagramSocket::BindType bind_type, |
518 const RandIntCallback& rand_int_cb, | 520 const RandIntCallback& rand_int_cb, |
519 NetLog* net_log, | 521 NetLog* net_log, |
520 const NetLog::Source& source) override; | 522 const NetLogSource& source) override; |
521 std::unique_ptr<StreamSocket> CreateTransportClientSocket( | 523 std::unique_ptr<StreamSocket> CreateTransportClientSocket( |
522 const AddressList& addresses, | 524 const AddressList& addresses, |
523 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 525 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
524 NetLog* net_log, | 526 NetLog* net_log, |
525 const NetLog::Source& source) override; | 527 const NetLogSource& source) override; |
526 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( | 528 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( |
527 std::unique_ptr<ClientSocketHandle> transport_socket, | 529 std::unique_ptr<ClientSocketHandle> transport_socket, |
528 const HostPortPair& host_and_port, | 530 const HostPortPair& host_and_port, |
529 const SSLConfig& ssl_config, | 531 const SSLConfig& ssl_config, |
530 const SSLClientSocketContext& context) override; | 532 const SSLClientSocketContext& context) override; |
531 void ClearSSLSessionCache() override; | 533 void ClearSSLSessionCache() override; |
532 | 534 |
533 const std::vector<uint16_t>& udp_client_socket_ports() const { | 535 const std::vector<uint16_t>& udp_client_socket_ports() const { |
534 return udp_client_socket_ports_; | 536 return udp_client_socket_ports_; |
535 } | 537 } |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 | 1011 |
1010 // Helper function to get the total data size of the MockReads in |reads|. | 1012 // Helper function to get the total data size of the MockReads in |reads|. |
1011 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 1013 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
1012 | 1014 |
1013 // Helper function to get the total data size of the MockWrites in |writes|. | 1015 // Helper function to get the total data size of the MockWrites in |writes|. |
1014 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1016 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
1015 | 1017 |
1016 } // namespace net | 1018 } // namespace net |
1017 | 1019 |
1018 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1020 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |