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

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

Issue 227473008: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Original CL, as was submitted, and previously reverted Created 6 years, 8 months 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 | Annotate | Revision Log
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 706
707 MockClientSocket::MockClientSocket(const BoundNetLog& net_log) 707 MockClientSocket::MockClientSocket(const BoundNetLog& net_log)
708 : connected_(false), 708 : connected_(false),
709 net_log_(net_log), 709 net_log_(net_log),
710 weak_factory_(this) { 710 weak_factory_(this) {
711 IPAddressNumber ip; 711 IPAddressNumber ip;
712 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); 712 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip));
713 peer_addr_ = IPEndPoint(ip, 0); 713 peer_addr_ = IPEndPoint(ip, 0);
714 } 714 }
715 715
716 bool MockClientSocket::SetReceiveBufferSize(int32 size) { 716 int MockClientSocket::SetReceiveBufferSize(int32 size) {
717 return true; 717 return OK;
718 } 718 }
719 719
720 bool MockClientSocket::SetSendBufferSize(int32 size) { 720 int MockClientSocket::SetSendBufferSize(int32 size) {
721 return true; 721 return OK;
722 } 722 }
723 723
724 void MockClientSocket::Disconnect() { 724 void MockClientSocket::Disconnect() {
725 connected_ = false; 725 connected_ = false;
726 } 726 }
727 727
728 bool MockClientSocket::IsConnected() const { 728 bool MockClientSocket::IsConnected() const {
729 return connected_; 729 return connected_;
730 } 730 }
731 731
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 int DeterministicMockUDPClientSocket::Read( 1155 int DeterministicMockUDPClientSocket::Read(
1156 IOBuffer* buf, 1156 IOBuffer* buf,
1157 int buf_len, 1157 int buf_len,
1158 const CompletionCallback& callback) { 1158 const CompletionCallback& callback) {
1159 if (!connected_) 1159 if (!connected_)
1160 return ERR_UNEXPECTED; 1160 return ERR_UNEXPECTED;
1161 1161
1162 return helper_.Read(buf, buf_len, callback); 1162 return helper_.Read(buf, buf_len, callback);
1163 } 1163 }
1164 1164
1165 bool DeterministicMockUDPClientSocket::SetReceiveBufferSize(int32 size) { 1165 int DeterministicMockUDPClientSocket::SetReceiveBufferSize(int32 size) {
1166 return true; 1166 return OK;
1167 } 1167 }
1168 1168
1169 bool DeterministicMockUDPClientSocket::SetSendBufferSize(int32 size) { 1169 int DeterministicMockUDPClientSocket::SetSendBufferSize(int32 size) {
1170 return true; 1170 return OK;
1171 } 1171 }
1172 1172
1173 void DeterministicMockUDPClientSocket::Close() { 1173 void DeterministicMockUDPClientSocket::Close() {
1174 connected_ = false; 1174 connected_ = false;
1175 } 1175 }
1176 1176
1177 int DeterministicMockUDPClientSocket::GetPeerAddress( 1177 int DeterministicMockUDPClientSocket::GetPeerAddress(
1178 IPEndPoint* address) const { 1178 IPEndPoint* address) const {
1179 *address = peer_address_; 1179 *address = peer_address_;
1180 return OK; 1180 return OK;
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 std::string data(buf->data(), buf_len); 1501 std::string data(buf->data(), buf_len);
1502 MockWriteResult write_result = data_->OnWrite(data); 1502 MockWriteResult write_result = data_->OnWrite(data);
1503 1503
1504 if (write_result.mode == ASYNC) { 1504 if (write_result.mode == ASYNC) {
1505 RunCallbackAsync(callback, write_result.result); 1505 RunCallbackAsync(callback, write_result.result);
1506 return ERR_IO_PENDING; 1506 return ERR_IO_PENDING;
1507 } 1507 }
1508 return write_result.result; 1508 return write_result.result;
1509 } 1509 }
1510 1510
1511 bool MockUDPClientSocket::SetReceiveBufferSize(int32 size) { 1511 int MockUDPClientSocket::SetReceiveBufferSize(int32 size) {
1512 return true; 1512 return OK;
1513 } 1513 }
1514 1514
1515 bool MockUDPClientSocket::SetSendBufferSize(int32 size) { 1515 int MockUDPClientSocket::SetSendBufferSize(int32 size) {
1516 return true; 1516 return OK;
1517 } 1517 }
1518 1518
1519 void MockUDPClientSocket::Close() { 1519 void MockUDPClientSocket::Close() {
1520 connected_ = false; 1520 connected_ = false;
1521 } 1521 }
1522 1522
1523 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const { 1523 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const {
1524 *address = peer_addr_; 1524 *address = peer_addr_;
1525 return OK; 1525 return OK;
1526 } 1526 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 1899
1900 const char kSOCKS5OkRequest[] = 1900 const char kSOCKS5OkRequest[] =
1901 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1901 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1902 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1902 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1903 1903
1904 const char kSOCKS5OkResponse[] = 1904 const char kSOCKS5OkResponse[] =
1905 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1905 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1906 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1906 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1907 1907
1908 } // namespace net 1908 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698