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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 | 1288 |
1289 int DeterministicMockUDPClientSocket::CompleteRead() { | 1289 int DeterministicMockUDPClientSocket::CompleteRead() { |
1290 return helper_.CompleteRead(); | 1290 return helper_.CompleteRead(); |
1291 } | 1291 } |
1292 | 1292 |
1293 int DeterministicMockUDPClientSocket::BindToNetwork( | 1293 int DeterministicMockUDPClientSocket::BindToNetwork( |
1294 NetworkChangeNotifier::NetworkHandle network) { | 1294 NetworkChangeNotifier::NetworkHandle network) { |
1295 return ERR_NOT_IMPLEMENTED; | 1295 return ERR_NOT_IMPLEMENTED; |
1296 } | 1296 } |
1297 | 1297 |
| 1298 int DeterministicMockUDPClientSocket::BindToDefaultNetwork() { |
| 1299 return ERR_NOT_IMPLEMENTED; |
| 1300 } |
| 1301 |
| 1302 NetworkChangeNotifier::NetworkHandle |
| 1303 DeterministicMockUDPClientSocket::GetBoundNetwork() { |
| 1304 return NetworkChangeNotifier::kInvalidNetworkHandle; |
| 1305 } |
| 1306 |
1298 int DeterministicMockUDPClientSocket::Connect(const IPEndPoint& address) { | 1307 int DeterministicMockUDPClientSocket::Connect(const IPEndPoint& address) { |
1299 if (connected_) | 1308 if (connected_) |
1300 return OK; | 1309 return OK; |
1301 connected_ = true; | 1310 connected_ = true; |
1302 peer_address_ = address; | 1311 peer_address_ = address; |
1303 return helper_.data()->connect_data().result; | 1312 return helper_.data()->connect_data().result; |
1304 }; | 1313 }; |
1305 | 1314 |
1306 int DeterministicMockUDPClientSocket::Write( | 1315 int DeterministicMockUDPClientSocket::Write( |
1307 IOBuffer* buf, | 1316 IOBuffer* buf, |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 | 1668 |
1660 const BoundNetLog& MockUDPClientSocket::NetLog() const { | 1669 const BoundNetLog& MockUDPClientSocket::NetLog() const { |
1661 return net_log_; | 1670 return net_log_; |
1662 } | 1671 } |
1663 | 1672 |
1664 int MockUDPClientSocket::BindToNetwork( | 1673 int MockUDPClientSocket::BindToNetwork( |
1665 NetworkChangeNotifier::NetworkHandle network) { | 1674 NetworkChangeNotifier::NetworkHandle network) { |
1666 return ERR_NOT_IMPLEMENTED; | 1675 return ERR_NOT_IMPLEMENTED; |
1667 } | 1676 } |
1668 | 1677 |
| 1678 int MockUDPClientSocket::BindToDefaultNetwork() { |
| 1679 return ERR_NOT_IMPLEMENTED; |
| 1680 } |
| 1681 |
| 1682 NetworkChangeNotifier::NetworkHandle MockUDPClientSocket::GetBoundNetwork() { |
| 1683 return NetworkChangeNotifier::kInvalidNetworkHandle; |
| 1684 } |
| 1685 |
1669 int MockUDPClientSocket::Connect(const IPEndPoint& address) { | 1686 int MockUDPClientSocket::Connect(const IPEndPoint& address) { |
1670 connected_ = true; | 1687 connected_ = true; |
1671 peer_addr_ = address; | 1688 peer_addr_ = address; |
1672 return data_->connect_data().result; | 1689 return data_->connect_data().result; |
1673 } | 1690 } |
1674 | 1691 |
1675 void MockUDPClientSocket::OnReadComplete(const MockRead& data) { | 1692 void MockUDPClientSocket::OnReadComplete(const MockRead& data) { |
1676 // There must be a read pending. | 1693 // There must be a read pending. |
1677 DCHECK(pending_read_buf_.get()); | 1694 DCHECK(pending_read_buf_.get()); |
1678 // You can't complete a read with another ERR_IO_PENDING status code. | 1695 // You can't complete a read with another ERR_IO_PENDING status code. |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 } | 2087 } |
2071 | 2088 |
2072 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 2089 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
2073 int64_t total = 0; | 2090 int64_t total = 0; |
2074 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 2091 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
2075 total += write->data_len; | 2092 total += write->data_len; |
2076 return total; | 2093 return total; |
2077 } | 2094 } |
2078 | 2095 |
2079 } // namespace net | 2096 } // namespace net |
OLD | NEW |