| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/socket/socks_client_socket_pool.h" | 5 #include "net/socket/socks_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 CompletionCallbackImpl<MockConnectJob> connect_callback_; | 80 CompletionCallbackImpl<MockConnectJob> connect_callback_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(MockConnectJob); | 82 DISALLOW_COPY_AND_ASSIGN(MockConnectJob); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 MockTCPClientSocketPool(int max_sockets, int max_sockets_per_group, | 85 MockTCPClientSocketPool(int max_sockets, int max_sockets_per_group, |
| 86 const scoped_refptr<ClientSocketPoolHistograms>& histograms, | 86 const scoped_refptr<ClientSocketPoolHistograms>& histograms, |
| 87 ClientSocketFactory* socket_factory, | 87 ClientSocketFactory* socket_factory, |
| 88 NetworkChangeNotifier* network_change_notifier) | 88 NetworkChangeNotifier* network_change_notifier) |
| 89 : TCPClientSocketPool(max_sockets, max_sockets_per_group, histograms, | 89 : TCPClientSocketPool(max_sockets, max_sockets_per_group, histograms, |
| 90 NULL, NULL, network_change_notifier), | 90 NULL, NULL, network_change_notifier, NULL), |
| 91 client_socket_factory_(socket_factory), | 91 client_socket_factory_(socket_factory), |
| 92 release_count_(0), | 92 release_count_(0), |
| 93 cancel_count_(0) {} | 93 cancel_count_(0) {} |
| 94 | 94 |
| 95 int release_count() { return release_count_; }; | 95 int release_count() { return release_count_; }; |
| 96 int cancel_count() { return cancel_count_; }; | 96 int cancel_count() { return cancel_count_; }; |
| 97 | 97 |
| 98 // TCPClientSocketPool methods. | 98 // TCPClientSocketPool methods. |
| 99 virtual int RequestSocket(const std::string& group_name, | 99 virtual int RequestSocket(const std::string& group_name, |
| 100 const void* socket_params, | 100 const void* socket_params, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 tcp_histograms_(new ClientSocketPoolHistograms("MockTCP")), | 173 tcp_histograms_(new ClientSocketPoolHistograms("MockTCP")), |
| 174 tcp_socket_pool_(new MockTCPClientSocketPool( | 174 tcp_socket_pool_(new MockTCPClientSocketPool( |
| 175 kMaxSockets, kMaxSocketsPerGroup, tcp_histograms_, | 175 kMaxSockets, kMaxSocketsPerGroup, tcp_histograms_, |
| 176 &tcp_client_socket_factory_, &tcp_notifier_)), | 176 &tcp_client_socket_factory_, &tcp_notifier_)), |
| 177 ignored_socket_params_(ignored_tcp_socket_params_, true, | 177 ignored_socket_params_(ignored_tcp_socket_params_, true, |
| 178 HostPortPair("host", 80), | 178 HostPortPair("host", 80), |
| 179 MEDIUM, GURL()), | 179 MEDIUM, GURL()), |
| 180 socks_histograms_(new ClientSocketPoolHistograms("SOCKSUnitTest")), | 180 socks_histograms_(new ClientSocketPoolHistograms("SOCKSUnitTest")), |
| 181 pool_(new SOCKSClientSocketPool( | 181 pool_(new SOCKSClientSocketPool( |
| 182 kMaxSockets, kMaxSocketsPerGroup, socks_histograms_, NULL, | 182 kMaxSockets, kMaxSocketsPerGroup, socks_histograms_, NULL, |
| 183 tcp_socket_pool_, &socks_notifier_)) { | 183 tcp_socket_pool_, &socks_notifier_, NULL)) { |
| 184 } | 184 } |
| 185 | 185 |
| 186 int StartRequest(const std::string& group_name, RequestPriority priority) { | 186 int StartRequest(const std::string& group_name, RequestPriority priority) { |
| 187 return StartRequestUsingPool( | 187 return StartRequestUsingPool( |
| 188 pool_, group_name, priority, ignored_socket_params_); | 188 pool_, group_name, priority, ignored_socket_params_); |
| 189 } | 189 } |
| 190 | 190 |
| 191 TCPSocketParams ignored_tcp_socket_params_; | 191 TCPSocketParams ignored_tcp_socket_params_; |
| 192 scoped_refptr<ClientSocketPoolHistograms> tcp_histograms_; | 192 scoped_refptr<ClientSocketPoolHistograms> tcp_histograms_; |
| 193 MockClientSocketFactory tcp_client_socket_factory_; | 193 MockClientSocketFactory tcp_client_socket_factory_; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 requests_[0]->handle()->Reset(); | 370 requests_[0]->handle()->Reset(); |
| 371 requests_[1]->handle()->Reset(); | 371 requests_[1]->handle()->Reset(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 // It would be nice to also test the timeouts in SOCKSClientSocketPool. | 374 // It would be nice to also test the timeouts in SOCKSClientSocketPool. |
| 375 | 375 |
| 376 } // namespace | 376 } // namespace |
| 377 | 377 |
| 378 } // namespace net | 378 } // namespace net |
| OLD | NEW |