| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 DatagramSocket::BindType bind_type, | 208 DatagramSocket::BindType bind_type, |
| 208 const RandIntCallback& rand_int_cb, | 209 const RandIntCallback& rand_int_cb, |
| 209 NetLog* net_log, | 210 NetLog* net_log, |
| 210 const NetLog::Source& source) override { | 211 const NetLog::Source& source) override { |
| 211 NOTREACHED(); | 212 NOTREACHED(); |
| 212 return scoped_ptr<DatagramClientSocket>(); | 213 return scoped_ptr<DatagramClientSocket>(); |
| 213 } | 214 } |
| 214 | 215 |
| 215 scoped_ptr<StreamSocket> CreateTransportClientSocket( | 216 scoped_ptr<StreamSocket> CreateTransportClientSocket( |
| 216 const AddressList& addresses, | 217 const AddressList& addresses, |
| 218 scoped_ptr<SocketPerformanceWatcher> /* socket_performance_watcher */, |
| 217 NetLog* /* net_log */, | 219 NetLog* /* net_log */, |
| 218 const NetLog::Source& /*source*/) override { | 220 const NetLog::Source& /*source*/) override { |
| 219 allocation_count_++; | 221 allocation_count_++; |
| 220 return scoped_ptr<StreamSocket>(); | 222 return scoped_ptr<StreamSocket>(); |
| 221 } | 223 } |
| 222 | 224 |
| 223 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( | 225 scoped_ptr<SSLClientSocket> CreateSSLClientSocket( |
| 224 scoped_ptr<ClientSocketHandle> transport_socket, | 226 scoped_ptr<ClientSocketHandle> transport_socket, |
| 225 const HostPortPair& host_and_port, | 227 const HostPortPair& host_and_port, |
| 226 const SSLConfig& ssl_config, | 228 const SSLConfig& ssl_config, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 info.headers = new HttpResponseHeaders(std::string()); | 304 info.headers = new HttpResponseHeaders(std::string()); |
| 303 handle->set_ssl_error_response_info(info); | 305 handle->set_ssl_error_response_info(info); |
| 304 } | 306 } |
| 305 } | 307 } |
| 306 | 308 |
| 307 private: | 309 private: |
| 308 // From ConnectJob: | 310 // From ConnectJob: |
| 309 | 311 |
| 310 int ConnectInternal() override { | 312 int ConnectInternal() override { |
| 311 AddressList ignored; | 313 AddressList ignored; |
| 312 client_socket_factory_->CreateTransportClientSocket(ignored, NULL, | 314 client_socket_factory_->CreateTransportClientSocket(ignored, NULL, NULL, |
| 313 NetLog::Source()); | 315 NetLog::Source()); |
| 314 SetSocket( | 316 SetSocket( |
| 315 scoped_ptr<StreamSocket>(new MockClientSocket(net_log().net_log()))); | 317 scoped_ptr<StreamSocket>(new MockClientSocket(net_log().net_log()))); |
| 316 switch (job_type_) { | 318 switch (job_type_) { |
| 317 case kMockJob: | 319 case kMockJob: |
| 318 return DoConnect(true /* successful */, false /* sync */, | 320 return DoConnect(true /* successful */, false /* sync */, |
| 319 false /* recoverable */); | 321 false /* recoverable */); |
| 320 case kMockFailingJob: | 322 case kMockFailingJob: |
| 321 return DoConnect(false /* error */, false /* sync */, | 323 return DoConnect(false /* error */, false /* sync */, |
| 322 false /* recoverable */); | 324 false /* recoverable */); |
| (...skipping 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3838 request(1)->handle()->Reset(); | 3840 request(1)->handle()->Reset(); |
| 3839 ASSERT_EQ(1, pool_->NumConnectJobsInGroup("a")); | 3841 ASSERT_EQ(1, pool_->NumConnectJobsInGroup("a")); |
| 3840 | 3842 |
| 3841 EXPECT_EQ(OK, request(2)->WaitForResult()); | 3843 EXPECT_EQ(OK, request(2)->WaitForResult()); |
| 3842 EXPECT_FALSE(request(1)->have_result()); | 3844 EXPECT_FALSE(request(1)->have_result()); |
| 3843 } | 3845 } |
| 3844 | 3846 |
| 3845 } // namespace | 3847 } // namespace |
| 3846 | 3848 |
| 3847 } // namespace net | 3849 } // namespace net |
| OLD | NEW |