Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: net/socket/socket_test_util.cc

Issue 1416213003: Add DatagramClientSocket::BindToDefaultNetwork(),GetBoundNetwork() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: loop only twice Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/udp/datagram_client_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1286
1287 int DeterministicMockUDPClientSocket::CompleteRead() { 1287 int DeterministicMockUDPClientSocket::CompleteRead() {
1288 return helper_.CompleteRead(); 1288 return helper_.CompleteRead();
1289 } 1289 }
1290 1290
1291 int DeterministicMockUDPClientSocket::BindToNetwork( 1291 int DeterministicMockUDPClientSocket::BindToNetwork(
1292 NetworkChangeNotifier::NetworkHandle network) { 1292 NetworkChangeNotifier::NetworkHandle network) {
1293 return ERR_NOT_IMPLEMENTED; 1293 return ERR_NOT_IMPLEMENTED;
1294 } 1294 }
1295 1295
1296 int DeterministicMockUDPClientSocket::BindToDefaultNetwork() {
1297 return ERR_NOT_IMPLEMENTED;
1298 }
1299
1300 NetworkChangeNotifier::NetworkHandle
1301 DeterministicMockUDPClientSocket::GetBoundNetwork() {
1302 return NetworkChangeNotifier::kInvalidNetworkHandle;
1303 }
1304
1296 int DeterministicMockUDPClientSocket::Connect(const IPEndPoint& address) { 1305 int DeterministicMockUDPClientSocket::Connect(const IPEndPoint& address) {
1297 if (connected_) 1306 if (connected_)
1298 return OK; 1307 return OK;
1299 connected_ = true; 1308 connected_ = true;
1300 peer_address_ = address; 1309 peer_address_ = address;
1301 return helper_.data()->connect_data().result; 1310 return helper_.data()->connect_data().result;
1302 }; 1311 };
1303 1312
1304 int DeterministicMockUDPClientSocket::Write( 1313 int DeterministicMockUDPClientSocket::Write(
1305 IOBuffer* buf, 1314 IOBuffer* buf,
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 1666
1658 const BoundNetLog& MockUDPClientSocket::NetLog() const { 1667 const BoundNetLog& MockUDPClientSocket::NetLog() const {
1659 return net_log_; 1668 return net_log_;
1660 } 1669 }
1661 1670
1662 int MockUDPClientSocket::BindToNetwork( 1671 int MockUDPClientSocket::BindToNetwork(
1663 NetworkChangeNotifier::NetworkHandle network) { 1672 NetworkChangeNotifier::NetworkHandle network) {
1664 return ERR_NOT_IMPLEMENTED; 1673 return ERR_NOT_IMPLEMENTED;
1665 } 1674 }
1666 1675
1676 int MockUDPClientSocket::BindToDefaultNetwork() {
1677 return ERR_NOT_IMPLEMENTED;
1678 }
1679
1680 NetworkChangeNotifier::NetworkHandle MockUDPClientSocket::GetBoundNetwork() {
1681 return NetworkChangeNotifier::kInvalidNetworkHandle;
1682 }
1683
1667 int MockUDPClientSocket::Connect(const IPEndPoint& address) { 1684 int MockUDPClientSocket::Connect(const IPEndPoint& address) {
1668 connected_ = true; 1685 connected_ = true;
1669 peer_addr_ = address; 1686 peer_addr_ = address;
1670 return data_->connect_data().result; 1687 return data_->connect_data().result;
1671 } 1688 }
1672 1689
1673 void MockUDPClientSocket::OnReadComplete(const MockRead& data) { 1690 void MockUDPClientSocket::OnReadComplete(const MockRead& data) {
1674 // There must be a read pending. 1691 // There must be a read pending.
1675 DCHECK(pending_read_buf_.get()); 1692 DCHECK(pending_read_buf_.get());
1676 // You can't complete a read with another ERR_IO_PENDING status code. 1693 // You can't complete a read with another ERR_IO_PENDING status code.
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 } 2083 }
2067 2084
2068 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { 2085 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) {
2069 int64_t total = 0; 2086 int64_t total = 0;
2070 for (const MockWrite* write = writes; write != writes + writes_size; ++write) 2087 for (const MockWrite* write = writes; write != writes + writes_size; ++write)
2071 total += write->data_len; 2088 total += write->data_len;
2072 return total; 2089 return total;
2073 } 2090 }
2074 2091
2075 } // namespace net 2092 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/udp/datagram_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698