| 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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 last_request_priority_ = priority; | 1634 last_request_priority_ = priority; |
| 1635 std::unique_ptr<StreamSocket> socket = | 1635 std::unique_ptr<StreamSocket> socket = |
| 1636 client_socket_factory_->CreateTransportClientSocket( | 1636 client_socket_factory_->CreateTransportClientSocket( |
| 1637 AddressList(), NULL, net_log.net_log(), NetLog::Source()); | 1637 AddressList(), NULL, net_log.net_log(), NetLog::Source()); |
| 1638 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); | 1638 MockConnectJob* job = new MockConnectJob(std::move(socket), handle, callback); |
| 1639 job_list_.push_back(base::WrapUnique(job)); | 1639 job_list_.push_back(base::WrapUnique(job)); |
| 1640 handle->set_pool_id(1); | 1640 handle->set_pool_id(1); |
| 1641 return job->Connect(); | 1641 return job->Connect(); |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 void MockTransportClientSocketPool::SetPriority(const std::string& group_name, |
| 1645 ClientSocketHandle* handle, |
| 1646 RequestPriority priority) { |
| 1647 // TODO: Implement. |
| 1648 } |
| 1649 |
| 1644 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, | 1650 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, |
| 1645 ClientSocketHandle* handle) { | 1651 ClientSocketHandle* handle) { |
| 1646 for (std::unique_ptr<MockConnectJob>& it : job_list_) { | 1652 for (std::unique_ptr<MockConnectJob>& it : job_list_) { |
| 1647 if (it->CancelHandle(handle)) { | 1653 if (it->CancelHandle(handle)) { |
| 1648 cancel_count_++; | 1654 cancel_count_++; |
| 1649 break; | 1655 break; |
| 1650 } | 1656 } |
| 1651 } | 1657 } |
| 1652 } | 1658 } |
| 1653 | 1659 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1678 RequestPriority priority, | 1684 RequestPriority priority, |
| 1679 RespectLimits respect_limits, | 1685 RespectLimits respect_limits, |
| 1680 ClientSocketHandle* handle, | 1686 ClientSocketHandle* handle, |
| 1681 const CompletionCallback& callback, | 1687 const CompletionCallback& callback, |
| 1682 const BoundNetLog& net_log) { | 1688 const BoundNetLog& net_log) { |
| 1683 return transport_pool_->RequestSocket(group_name, socket_params, priority, | 1689 return transport_pool_->RequestSocket(group_name, socket_params, priority, |
| 1684 respect_limits, handle, callback, | 1690 respect_limits, handle, callback, |
| 1685 net_log); | 1691 net_log); |
| 1686 } | 1692 } |
| 1687 | 1693 |
| 1694 void MockSOCKSClientSocketPool::SetPriority(const std::string& group_name, |
| 1695 ClientSocketHandle* handle, |
| 1696 RequestPriority priority) { |
| 1697 transport_pool_->SetPriority(group_name, handle, priority); |
| 1698 } |
| 1699 |
| 1688 void MockSOCKSClientSocketPool::CancelRequest( | 1700 void MockSOCKSClientSocketPool::CancelRequest( |
| 1689 const std::string& group_name, | 1701 const std::string& group_name, |
| 1690 ClientSocketHandle* handle) { | 1702 ClientSocketHandle* handle) { |
| 1691 return transport_pool_->CancelRequest(group_name, handle); | 1703 return transport_pool_->CancelRequest(group_name, handle); |
| 1692 } | 1704 } |
| 1693 | 1705 |
| 1694 void MockSOCKSClientSocketPool::ReleaseSocket( | 1706 void MockSOCKSClientSocketPool::ReleaseSocket( |
| 1695 const std::string& group_name, | 1707 const std::string& group_name, |
| 1696 std::unique_ptr<StreamSocket> socket, | 1708 std::unique_ptr<StreamSocket> socket, |
| 1697 int id) { | 1709 int id) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 } | 1747 } |
| 1736 | 1748 |
| 1737 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 1749 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
| 1738 int64_t total = 0; | 1750 int64_t total = 0; |
| 1739 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 1751 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
| 1740 total += write->data_len; | 1752 total += write->data_len; |
| 1741 return total; | 1753 return total; |
| 1742 } | 1754 } |
| 1743 | 1755 |
| 1744 } // namespace net | 1756 } // namespace net |
| OLD | NEW |