| 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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const { | 1388 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const { |
| 1389 *address = peer_addr_; | 1389 *address = peer_addr_; |
| 1390 return OK; | 1390 return OK; |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 int MockUDPClientSocket::GetLocalAddress(IPEndPoint* address) const { | 1393 int MockUDPClientSocket::GetLocalAddress(IPEndPoint* address) const { |
| 1394 *address = IPEndPoint(IPAddress(192, 0, 2, 33), source_port_); | 1394 *address = IPEndPoint(IPAddress(192, 0, 2, 33), source_port_); |
| 1395 return OK; | 1395 return OK; |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 void MockUDPClientSocket::UseNonBlockingIO() {} | |
| 1399 | |
| 1400 const NetLogWithSource& MockUDPClientSocket::NetLog() const { | 1398 const NetLogWithSource& MockUDPClientSocket::NetLog() const { |
| 1401 return net_log_; | 1399 return net_log_; |
| 1402 } | 1400 } |
| 1403 | 1401 |
| 1404 int MockUDPClientSocket::Connect(const IPEndPoint& address) { | 1402 int MockUDPClientSocket::Connect(const IPEndPoint& address) { |
| 1405 if (!data_) | 1403 if (!data_) |
| 1406 return ERR_UNEXPECTED; | 1404 return ERR_UNEXPECTED; |
| 1407 connected_ = true; | 1405 connected_ = true; |
| 1408 peer_addr_ = address; | 1406 peer_addr_ = address; |
| 1409 return data_->connect_data().result; | 1407 return data_->connect_data().result; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 } | 1787 } |
| 1790 | 1788 |
| 1791 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { | 1789 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { |
| 1792 int64_t total = 0; | 1790 int64_t total = 0; |
| 1793 for (const MockWrite* write = writes; write != writes + writes_size; ++write) | 1791 for (const MockWrite* write = writes; write != writes + writes_size; ++write) |
| 1794 total += write->data_len; | 1792 total += write->data_len; |
| 1795 return total; | 1793 return total; |
| 1796 } | 1794 } |
| 1797 | 1795 |
| 1798 } // namespace net | 1796 } // namespace net |
| OLD | NEW |