OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Test methods and classes common to transport_client_socket_pool_unittest.cc | 5 // Test methods and classes common to transport_client_socket_pool_unittest.cc |
6 // and websocket_transport_client_socket_pool_unittest.cc. If you find you need | 6 // and websocket_transport_client_socket_pool_unittest.cc. If you find you need |
7 // to use these for another purpose, consider moving them to socket_test_util.h. | 7 // to use these for another purpose, consider moving them to socket_test_util.h. |
8 | 8 |
9 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_TEST_UTIL_H_ | 9 #ifndef NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_TEST_UTIL_H_ |
10 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_TEST_UTIL_H_ | 10 #define NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_TEST_UTIL_H_ |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 MOCK_DELAYED_CLIENT_SOCKET, | 60 MOCK_DELAYED_CLIENT_SOCKET, |
61 // A delayed socket that fails. | 61 // A delayed socket that fails. |
62 MOCK_DELAYED_FAILING_CLIENT_SOCKET, | 62 MOCK_DELAYED_FAILING_CLIENT_SOCKET, |
63 // A stalled socket that never connects at all. | 63 // A stalled socket that never connects at all. |
64 MOCK_STALLED_CLIENT_SOCKET, | 64 MOCK_STALLED_CLIENT_SOCKET, |
65 // A socket that can be triggered to connect explicitly, asynchronously. | 65 // A socket that can be triggered to connect explicitly, asynchronously. |
66 MOCK_TRIGGERABLE_CLIENT_SOCKET, | 66 MOCK_TRIGGERABLE_CLIENT_SOCKET, |
67 }; | 67 }; |
68 | 68 |
69 explicit MockTransportClientSocketFactory(NetLog* net_log); | 69 explicit MockTransportClientSocketFactory(NetLog* net_log); |
70 virtual ~MockTransportClientSocketFactory(); | 70 ~MockTransportClientSocketFactory() override; |
71 | 71 |
72 virtual scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket( | 72 scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
73 DatagramSocket::BindType bind_type, | 73 DatagramSocket::BindType bind_type, |
74 const RandIntCallback& rand_int_cb, | 74 const RandIntCallback& rand_int_cb, |
75 NetLog* net_log, | 75 NetLog* net_log, |
76 const NetLog::Source& source) override; | 76 const NetLog::Source& source) override; |
77 | 77 |
78 virtual scoped_ptr<StreamSocket> CreateTransportClientSocket( | 78 scoped_ptr<StreamSocket> CreateTransportClientSocket( |
79 const AddressList& addresses, | 79 const AddressList& addresses, |
80 NetLog* /* net_log */, | 80 NetLog* /* net_log */, |
81 const NetLog::Source& /* source */) override; | 81 const NetLog::Source& /* source */) override; |
82 | 82 |
83 virtual scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 83 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
84 scoped_ptr<ClientSocketHandle> transport_socket, | 84 scoped_ptr<ClientSocketHandle> transport_socket, |
85 const HostPortPair& host_and_port, | 85 const HostPortPair& host_and_port, |
86 const SSLConfig& ssl_config, | 86 const SSLConfig& ssl_config, |
87 const SSLClientSocketContext& context) override; | 87 const SSLClientSocketContext& context) override; |
88 | 88 |
89 virtual void ClearSSLSessionCache() override; | 89 void ClearSSLSessionCache() override; |
90 | 90 |
91 int allocation_count() const { return allocation_count_; } | 91 int allocation_count() const { return allocation_count_; } |
92 | 92 |
93 // Set the default ClientSocketType. | 93 // Set the default ClientSocketType. |
94 void set_default_client_socket_type(ClientSocketType type) { | 94 void set_default_client_socket_type(ClientSocketType type) { |
95 client_socket_type_ = type; | 95 client_socket_type_ = type; |
96 } | 96 } |
97 | 97 |
98 // Set a list of ClientSocketTypes to be used. | 98 // Set a list of ClientSocketTypes to be used. |
99 void set_client_socket_types(ClientSocketType* type_list, int num_types); | 99 void set_client_socket_types(ClientSocketType* type_list, int num_types); |
(...skipping 18 matching lines...) Expand all Loading... |
118 base::TimeDelta delay_; | 118 base::TimeDelta delay_; |
119 std::queue<base::Closure> triggerable_sockets_; | 119 std::queue<base::Closure> triggerable_sockets_; |
120 base::Closure run_loop_quit_closure_; | 120 base::Closure run_loop_quit_closure_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(MockTransportClientSocketFactory); | 122 DISALLOW_COPY_AND_ASSIGN(MockTransportClientSocketFactory); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace net | 125 } // namespace net |
126 | 126 |
127 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_TEST_UTIL_H_ | 127 #endif // NET_SOCKET_TRANSPORT_CLIENT_SOCKET_POOL_TEST_UTIL_H_ |
OLD | NEW |