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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const { | 1338 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const { |
1339 *address = peer_addr_; | 1339 *address = peer_addr_; |
1340 return OK; | 1340 return OK; |
1341 } | 1341 } |
1342 | 1342 |
1343 int MockUDPClientSocket::GetLocalAddress(IPEndPoint* address) const { | 1343 int MockUDPClientSocket::GetLocalAddress(IPEndPoint* address) const { |
1344 *address = IPEndPoint(IPAddress(192, 0, 2, 33), source_port_); | 1344 *address = IPEndPoint(IPAddress(192, 0, 2, 33), source_port_); |
1345 return OK; | 1345 return OK; |
1346 } | 1346 } |
1347 | 1347 |
| 1348 void MockUDPClientSocket::UseNonBlockingIO() {} |
| 1349 |
1348 const BoundNetLog& MockUDPClientSocket::NetLog() const { | 1350 const BoundNetLog& MockUDPClientSocket::NetLog() const { |
1349 return net_log_; | 1351 return net_log_; |
1350 } | 1352 } |
1351 | 1353 |
1352 int MockUDPClientSocket::Connect(const IPEndPoint& address) { | 1354 int MockUDPClientSocket::Connect(const IPEndPoint& address) { |
1353 if (!data_) | 1355 if (!data_) |
1354 return ERR_UNEXPECTED; | 1356 return ERR_UNEXPECTED; |
1355 connected_ = true; | 1357 connected_ = true; |
1356 peer_addr_ = address; | 1358 peer_addr_ = address; |
1357 return data_->connect_data().result; | 1359 return data_->connect_data().result; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 } | 1727 } |
1726 | 1728 |
1727 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 1729 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
1728 int64_t total = 0; | 1730 int64_t total = 0; |
1729 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 1731 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
1730 total += write->data_len; | 1732 total += write->data_len; |
1731 return total; | 1733 return total; |
1732 } | 1734 } |
1733 | 1735 |
1734 } // namespace net | 1736 } // namespace net |
OLD | NEW |