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/socket_test_util.h" | 5 #include "net/socket/socket_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 new MockUDPClientSocket(data_provider, net_log)); | 709 new MockUDPClientSocket(data_provider, net_log)); |
710 if (bind_type == DatagramSocket::RANDOM_BIND) | 710 if (bind_type == DatagramSocket::RANDOM_BIND) |
711 socket->set_source_port( | 711 socket->set_source_port( |
712 static_cast<uint16_t>(rand_int_cb.Run(1025, 65535))); | 712 static_cast<uint16_t>(rand_int_cb.Run(1025, 65535))); |
713 udp_client_socket_ports_.push_back(socket->source_port()); | 713 udp_client_socket_ports_.push_back(socket->source_port()); |
714 return std::move(socket); | 714 return std::move(socket); |
715 } | 715 } |
716 | 716 |
717 scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket( | 717 scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket( |
718 const AddressList& addresses, | 718 const AddressList& addresses, |
| 719 SocketPerformanceWatcherFactory* socket_performance_watcher_factory, |
719 NetLog* net_log, | 720 NetLog* net_log, |
720 const NetLog::Source& source) { | 721 const NetLog::Source& source) { |
721 SocketDataProvider* data_provider = mock_data_.GetNext(); | 722 SocketDataProvider* data_provider = mock_data_.GetNext(); |
722 scoped_ptr<MockTCPClientSocket> socket( | 723 scoped_ptr<MockTCPClientSocket> socket( |
723 new MockTCPClientSocket(addresses, net_log, data_provider)); | 724 new MockTCPClientSocket(addresses, net_log, data_provider)); |
724 return std::move(socket); | 725 return std::move(socket); |
725 } | 726 } |
726 | 727 |
727 scoped_ptr<SSLClientSocket> MockClientSocketFactory::CreateSSLClientSocket( | 728 scoped_ptr<SSLClientSocket> MockClientSocketFactory::CreateSSLClientSocket( |
728 scoped_ptr<ClientSocketHandle> transport_socket, | 729 scoped_ptr<ClientSocketHandle> transport_socket, |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 const std::string& group_name, | 1615 const std::string& group_name, |
1615 const void* socket_params, | 1616 const void* socket_params, |
1616 RequestPriority priority, | 1617 RequestPriority priority, |
1617 RespectLimits respect_limits, | 1618 RespectLimits respect_limits, |
1618 ClientSocketHandle* handle, | 1619 ClientSocketHandle* handle, |
1619 const CompletionCallback& callback, | 1620 const CompletionCallback& callback, |
1620 const BoundNetLog& net_log) { | 1621 const BoundNetLog& net_log) { |
1621 last_request_priority_ = priority; | 1622 last_request_priority_ = priority; |
1622 scoped_ptr<StreamSocket> socket = | 1623 scoped_ptr<StreamSocket> socket = |
1623 client_socket_factory_->CreateTransportClientSocket( | 1624 client_socket_factory_->CreateTransportClientSocket( |
1624 AddressList(), net_log.net_log(), NetLog::Source()); | 1625 AddressList(), NULL, net_log.net_log(), NetLog::Source()); |
1625 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); | 1626 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); |
1626 job_list_.push_back(make_scoped_ptr(job)); | 1627 job_list_.push_back(make_scoped_ptr(job)); |
1627 handle->set_pool_id(1); | 1628 handle->set_pool_id(1); |
1628 return job->Connect(); | 1629 return job->Connect(); |
1629 } | 1630 } |
1630 | 1631 |
1631 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, | 1632 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, |
1632 ClientSocketHandle* handle) { | 1633 ClientSocketHandle* handle) { |
1633 for (scoped_ptr<MockConnectJob>& it : job_list_) { | 1634 for (scoped_ptr<MockConnectJob>& it : job_list_) { |
1634 if (it->CancelHandle(handle)) { | 1635 if (it->CancelHandle(handle)) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 } | 1722 } |
1722 | 1723 |
1723 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 1724 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
1724 int64_t total = 0; | 1725 int64_t total = 0; |
1725 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 1726 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
1726 total += write->data_len; | 1727 total += write->data_len; |
1727 return total; | 1728 return total; |
1728 } | 1729 } |
1729 | 1730 |
1730 } // namespace net | 1731 } // namespace net |
OLD | NEW |