| 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 #include "net/socket/client_socket_pool_base.h" | 5 #include "net/socket/client_socket_pool_base.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "base/thread_task_runner_handle.h" | 25 #include "base/thread_task_runner_handle.h" |
| 26 #include "base/threading/platform_thread.h" | 26 #include "base/threading/platform_thread.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "net/base/load_timing_info.h" | 28 #include "net/base/load_timing_info.h" |
| 29 #include "net/base/load_timing_info_test_util.h" | 29 #include "net/base/load_timing_info_test_util.h" |
| 30 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
| 31 #include "net/base/request_priority.h" | 31 #include "net/base/request_priority.h" |
| 32 #include "net/base/socket_performance_watcher.h" |
| 32 #include "net/base/test_completion_callback.h" | 33 #include "net/base/test_completion_callback.h" |
| 33 #include "net/http/http_response_headers.h" | 34 #include "net/http/http_response_headers.h" |
| 34 #include "net/log/net_log.h" | 35 #include "net/log/net_log.h" |
| 35 #include "net/log/test_net_log.h" | 36 #include "net/log/test_net_log.h" |
| 36 #include "net/log/test_net_log_entry.h" | 37 #include "net/log/test_net_log_entry.h" |
| 37 #include "net/log/test_net_log_util.h" | 38 #include "net/log/test_net_log_util.h" |
| 38 #include "net/socket/client_socket_factory.h" | 39 #include "net/socket/client_socket_factory.h" |
| 39 #include "net/socket/client_socket_handle.h" | 40 #include "net/socket/client_socket_handle.h" |
| 40 #include "net/socket/socket_test_util.h" | 41 #include "net/socket/socket_test_util.h" |
| 41 #include "net/socket/ssl_client_socket.h" | 42 #include "net/socket/ssl_client_socket.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 DatagramSocket::BindType bind_type, | 209 DatagramSocket::BindType bind_type, |
| 209 const RandIntCallback& rand_int_cb, | 210 const RandIntCallback& rand_int_cb, |
| 210 NetLog* net_log, | 211 NetLog* net_log, |
| 211 const NetLog::Source& source) override { | 212 const NetLog::Source& source) override { |
| 212 NOTREACHED(); | 213 NOTREACHED(); |
| 213 return scoped_ptr<DatagramClientSocket>(); | 214 return scoped_ptr<DatagramClientSocket>(); |
| 214 } | 215 } |
| 215 | 216 |
| 216 scoped_ptr<StreamSocket> CreateTransportClientSocket( | 217 scoped_ptr<StreamSocket> CreateTransportClientSocket( |
| 217 const AddressList& addresses, | 218 const AddressList& addresses, |
| 219 scoped_ptr<SocketPerformanceWatcher> /* socket_performance_watcher */, |
| 218 NetLog* /* net_log */, | 220 NetLog* /* net_log */, |
| 219 const NetLog::Source& /*source*/) override { | 221 const NetLog::Source& /*source*/) override { |
| 220 allocation_count_++; | 222 allocation_count_++; |
| 221 return scoped_ptr<StreamSocket>(); | 223 return scoped_ptr<StreamSocket>(); |
| 222 } | 224 } |
| 223 | 225 |
| 224 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 226 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
| 225 scoped_ptr<ClientSocketHandle> transport_socket, | 227 scoped_ptr<ClientSocketHandle> transport_socket, |
| 226 const HostPortPair& host_and_port, | 228 const HostPortPair& host_and_port, |
| 227 const SSLConfig& ssl_config, | 229 const SSLConfig& ssl_config, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 info.headers = new HttpResponseHeaders(std::string()); | 305 info.headers = new HttpResponseHeaders(std::string()); |
| 304 handle->set_ssl_error_response_info(info); | 306 handle->set_ssl_error_response_info(info); |
| 305 } | 307 } |
| 306 } | 308 } |
| 307 | 309 |
| 308 private: | 310 private: |
| 309 // From ConnectJob: | 311 // From ConnectJob: |
| 310 | 312 |
| 311 int ConnectInternal() override { | 313 int ConnectInternal() override { |
| 312 AddressList ignored; | 314 AddressList ignored; |
| 313 client_socket_factory_->CreateTransportClientSocket(ignored, NULL, | 315 client_socket_factory_->CreateTransportClientSocket(ignored, NULL, NULL, |
| 314 NetLog::Source()); | 316 NetLog::Source()); |
| 315 SetSocket( | 317 SetSocket( |
| 316 scoped_ptr<StreamSocket>(new MockClientSocket(net_log().net_log()))); | 318 scoped_ptr<StreamSocket>(new MockClientSocket(net_log().net_log()))); |
| 317 switch (job_type_) { | 319 switch (job_type_) { |
| 318 case kMockJob: | 320 case kMockJob: |
| 319 return DoConnect(true /* successful */, false /* sync */, | 321 return DoConnect(true /* successful */, false /* sync */, |
| 320 false /* recoverable */); | 322 false /* recoverable */); |
| 321 case kMockFailingJob: | 323 case kMockFailingJob: |
| 322 return DoConnect(false /* error */, false /* sync */, | 324 return DoConnect(false /* error */, false /* sync */, |
| 323 false /* recoverable */); | 325 false /* recoverable */); |
| (...skipping 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3839 request(1)->handle()->Reset(); | 3841 request(1)->handle()->Reset(); |
| 3840 ASSERT_EQ(1, pool_->NumConnectJobsInGroup("a")); | 3842 ASSERT_EQ(1, pool_->NumConnectJobsInGroup("a")); |
| 3841 | 3843 |
| 3842 EXPECT_EQ(OK, request(2)->WaitForResult()); | 3844 EXPECT_EQ(OK, request(2)->WaitForResult()); |
| 3843 EXPECT_FALSE(request(1)->have_result()); | 3845 EXPECT_FALSE(request(1)->have_result()); |
| 3844 } | 3846 } |
| 3845 | 3847 |
| 3846 } // namespace | 3848 } // namespace |
| 3847 | 3849 |
| 3848 } // namespace net | 3850 } // namespace net |
| OLD | NEW |