| 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 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 NULL), | 1588 NULL), |
| 1589 client_socket_factory_(socket_factory), | 1589 client_socket_factory_(socket_factory), |
| 1590 last_request_priority_(DEFAULT_PRIORITY), | 1590 last_request_priority_(DEFAULT_PRIORITY), |
| 1591 release_count_(0), | 1591 release_count_(0), |
| 1592 cancel_count_(0) { | 1592 cancel_count_(0) { |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 MockTransportClientSocketPool::~MockTransportClientSocketPool() {} | 1595 MockTransportClientSocketPool::~MockTransportClientSocketPool() {} |
| 1596 | 1596 |
| 1597 int MockTransportClientSocketPool::RequestSocket( | 1597 int MockTransportClientSocketPool::RequestSocket( |
| 1598 const std::string& group_name, const void* socket_params, | 1598 const std::string& group_name, |
| 1599 RequestPriority priority, ClientSocketHandle* handle, | 1599 const void* socket_params, |
| 1600 const CompletionCallback& callback, const BoundNetLog& net_log) { | 1600 RequestPriority priority, |
| 1601 bool ignore_limits, |
| 1602 ClientSocketHandle* handle, |
| 1603 const CompletionCallback& callback, |
| 1604 const BoundNetLog& net_log) { |
| 1601 last_request_priority_ = priority; | 1605 last_request_priority_ = priority; |
| 1602 scoped_ptr<StreamSocket> socket = | 1606 scoped_ptr<StreamSocket> socket = |
| 1603 client_socket_factory_->CreateTransportClientSocket( | 1607 client_socket_factory_->CreateTransportClientSocket( |
| 1604 AddressList(), net_log.net_log(), NetLog::Source()); | 1608 AddressList(), net_log.net_log(), NetLog::Source()); |
| 1605 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); | 1609 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); |
| 1606 job_list_.push_back(make_scoped_ptr(job)); | 1610 job_list_.push_back(make_scoped_ptr(job)); |
| 1607 handle->set_pool_id(1); | 1611 handle->set_pool_id(1); |
| 1608 return job->Connect(); | 1612 return job->Connect(); |
| 1609 } | 1613 } |
| 1610 | 1614 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1633 : SOCKSClientSocketPool(max_sockets, | 1637 : SOCKSClientSocketPool(max_sockets, |
| 1634 max_sockets_per_group, | 1638 max_sockets_per_group, |
| 1635 NULL, | 1639 NULL, |
| 1636 transport_pool, | 1640 transport_pool, |
| 1637 NULL), | 1641 NULL), |
| 1638 transport_pool_(transport_pool) { | 1642 transport_pool_(transport_pool) { |
| 1639 } | 1643 } |
| 1640 | 1644 |
| 1641 MockSOCKSClientSocketPool::~MockSOCKSClientSocketPool() {} | 1645 MockSOCKSClientSocketPool::~MockSOCKSClientSocketPool() {} |
| 1642 | 1646 |
| 1643 int MockSOCKSClientSocketPool::RequestSocket( | 1647 int MockSOCKSClientSocketPool::RequestSocket(const std::string& group_name, |
| 1644 const std::string& group_name, const void* socket_params, | 1648 const void* socket_params, |
| 1645 RequestPriority priority, ClientSocketHandle* handle, | 1649 RequestPriority priority, |
| 1646 const CompletionCallback& callback, const BoundNetLog& net_log) { | 1650 bool ignore_limits, |
| 1647 return transport_pool_->RequestSocket( | 1651 ClientSocketHandle* handle, |
| 1648 group_name, socket_params, priority, handle, callback, net_log); | 1652 const CompletionCallback& callback, |
| 1653 const BoundNetLog& net_log) { |
| 1654 return transport_pool_->RequestSocket(group_name, socket_params, priority, |
| 1655 ignore_limits, handle, callback, |
| 1656 net_log); |
| 1649 } | 1657 } |
| 1650 | 1658 |
| 1651 void MockSOCKSClientSocketPool::CancelRequest( | 1659 void MockSOCKSClientSocketPool::CancelRequest( |
| 1652 const std::string& group_name, | 1660 const std::string& group_name, |
| 1653 ClientSocketHandle* handle) { | 1661 ClientSocketHandle* handle) { |
| 1654 return transport_pool_->CancelRequest(group_name, handle); | 1662 return transport_pool_->CancelRequest(group_name, handle); |
| 1655 } | 1663 } |
| 1656 | 1664 |
| 1657 void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, | 1665 void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, |
| 1658 scoped_ptr<StreamSocket> socket, | 1666 scoped_ptr<StreamSocket> socket, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 } | 1705 } |
| 1698 | 1706 |
| 1699 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 1707 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
| 1700 int64_t total = 0; | 1708 int64_t total = 0; |
| 1701 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 1709 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
| 1702 total += write->data_len; | 1710 total += write->data_len; |
| 1703 return total; | 1711 return total; |
| 1704 } | 1712 } |
| 1705 | 1713 |
| 1706 } // namespace net | 1714 } // namespace net |
| OLD | NEW |