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 <cstring> | 8 #include <cstring> |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "base/time/time.h" |
21 #include "net/base/address_list.h" | 22 #include "net/base/address_list.h" |
22 #include "net/base/io_buffer.h" | 23 #include "net/base/io_buffer.h" |
23 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
24 #include "net/base/net_log.h" | 25 #include "net/base/net_log.h" |
25 #include "net/base/test_completion_callback.h" | 26 #include "net/base/test_completion_callback.h" |
26 #include "net/http/http_auth_controller.h" | 27 #include "net/http/http_auth_controller.h" |
27 #include "net/http/http_proxy_client_socket_pool.h" | 28 #include "net/http/http_proxy_client_socket_pool.h" |
28 #include "net/socket/client_socket_factory.h" | 29 #include "net/socket/client_socket_factory.h" |
29 #include "net/socket/client_socket_handle.h" | 30 #include "net/socket/client_socket_handle.h" |
30 #include "net/socket/socks_client_socket_pool.h" | 31 #include "net/socket/socks_client_socket_pool.h" |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 void ReleaseSocket(const std::string& group_name, | 1313 void ReleaseSocket(const std::string& group_name, |
1313 scoped_ptr<StreamSocket> socket, | 1314 scoped_ptr<StreamSocket> socket, |
1314 int id) override; | 1315 int id) override; |
1315 | 1316 |
1316 private: | 1317 private: |
1317 TransportClientSocketPool* const transport_pool_; | 1318 TransportClientSocketPool* const transport_pool_; |
1318 | 1319 |
1319 DISALLOW_COPY_AND_ASSIGN(MockSOCKSClientSocketPool); | 1320 DISALLOW_COPY_AND_ASSIGN(MockSOCKSClientSocketPool); |
1320 }; | 1321 }; |
1321 | 1322 |
| 1323 // Convenience class to temporarily set the WebSocketEndpointLockManager unlock |
| 1324 // delay to zero for testing purposes. Automatically restores the original value |
| 1325 // when destroyed. |
| 1326 class ScopedWebSocketEndpointZeroUnlockDelay { |
| 1327 public: |
| 1328 ScopedWebSocketEndpointZeroUnlockDelay(); |
| 1329 ~ScopedWebSocketEndpointZeroUnlockDelay(); |
| 1330 |
| 1331 private: |
| 1332 base::TimeDelta old_delay_; |
| 1333 }; |
| 1334 |
1322 // Constants for a successful SOCKS v5 handshake. | 1335 // Constants for a successful SOCKS v5 handshake. |
1323 extern const char kSOCKS5GreetRequest[]; | 1336 extern const char kSOCKS5GreetRequest[]; |
1324 extern const int kSOCKS5GreetRequestLength; | 1337 extern const int kSOCKS5GreetRequestLength; |
1325 | 1338 |
1326 extern const char kSOCKS5GreetResponse[]; | 1339 extern const char kSOCKS5GreetResponse[]; |
1327 extern const int kSOCKS5GreetResponseLength; | 1340 extern const int kSOCKS5GreetResponseLength; |
1328 | 1341 |
1329 extern const char kSOCKS5OkRequest[]; | 1342 extern const char kSOCKS5OkRequest[]; |
1330 extern const int kSOCKS5OkRequestLength; | 1343 extern const int kSOCKS5OkRequestLength; |
1331 | 1344 |
1332 extern const char kSOCKS5OkResponse[]; | 1345 extern const char kSOCKS5OkResponse[]; |
1333 extern const int kSOCKS5OkResponseLength; | 1346 extern const int kSOCKS5OkResponseLength; |
1334 | 1347 |
1335 } // namespace net | 1348 } // namespace net |
1336 | 1349 |
1337 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1350 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |