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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef 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/socket/socks5_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"
11 #include "base/bind.h" 10 #include "base/bind.h"
12 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
13 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
14 #include "base/location.h" 13 #include "base/location.h"
15 #include "base/logging.h" 14 #include "base/logging.h"
16 #include "base/run_loop.h" 15 #include "base/run_loop.h"
17 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
18 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
19 #include "base/time/time.h" 18 #include "base/time/time.h"
20 #include "net/base/address_family.h" 19 #include "net/base/address_family.h"
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 scoped_ptr<DatagramClientSocket> 700 scoped_ptr<DatagramClientSocket>
702 MockClientSocketFactory::CreateDatagramClientSocket( 701 MockClientSocketFactory::CreateDatagramClientSocket(
703 DatagramSocket::BindType bind_type, 702 DatagramSocket::BindType bind_type,
704 const RandIntCallback& rand_int_cb, 703 const RandIntCallback& rand_int_cb,
705 NetLog* net_log, 704 NetLog* net_log,
706 const NetLog::Source& source) { 705 const NetLog::Source& source) {
707 SocketDataProvider* data_provider = mock_data_.GetNext(); 706 SocketDataProvider* data_provider = mock_data_.GetNext();
708 scoped_ptr<MockUDPClientSocket> socket( 707 scoped_ptr<MockUDPClientSocket> socket(
709 new MockUDPClientSocket(data_provider, net_log)); 708 new MockUDPClientSocket(data_provider, net_log));
710 if (bind_type == DatagramSocket::RANDOM_BIND) 709 if (bind_type == DatagramSocket::RANDOM_BIND)
711 socket->set_source_port(static_cast<uint16>(rand_int_cb.Run(1025, 65535))); 710 socket->set_source_port(
711 static_cast<uint16_t>(rand_int_cb.Run(1025, 65535)));
712 udp_client_socket_ports_.push_back(socket->source_port()); 712 udp_client_socket_ports_.push_back(socket->source_port());
713 return socket.Pass(); 713 return socket.Pass();
714 } 714 }
715 715
716 scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket( 716 scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket(
717 const AddressList& addresses, 717 const AddressList& addresses,
718 NetLog* net_log, 718 NetLog* net_log,
719 const NetLog::Source& source) { 719 const NetLog::Source& source) {
720 SocketDataProvider* data_provider = mock_data_.GetNext(); 720 SocketDataProvider* data_provider = mock_data_.GetNext();
721 scoped_ptr<MockTCPClientSocket> socket( 721 scoped_ptr<MockTCPClientSocket> socket(
(...skipping 26 matching lines...) Expand all
748 748
749 MockClientSocket::MockClientSocket(const BoundNetLog& net_log) 749 MockClientSocket::MockClientSocket(const BoundNetLog& net_log)
750 : connected_(false), 750 : connected_(false),
751 net_log_(net_log), 751 net_log_(net_log),
752 weak_factory_(this) { 752 weak_factory_(this) {
753 IPAddressNumber ip; 753 IPAddressNumber ip;
754 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); 754 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip));
755 peer_addr_ = IPEndPoint(ip, 0); 755 peer_addr_ = IPEndPoint(ip, 0);
756 } 756 }
757 757
758 int MockClientSocket::SetReceiveBufferSize(int32 size) { 758 int MockClientSocket::SetReceiveBufferSize(int32_t size) {
759 return OK; 759 return OK;
760 } 760 }
761 761
762 int MockClientSocket::SetSendBufferSize(int32 size) { 762 int MockClientSocket::SetSendBufferSize(int32_t size) {
763 return OK; 763 return OK;
764 } 764 }
765 765
766 void MockClientSocket::Disconnect() { 766 void MockClientSocket::Disconnect() {
767 connected_ = false; 767 connected_ = false;
768 } 768 }
769 769
770 bool MockClientSocket::IsConnected() const { 770 bool MockClientSocket::IsConnected() const {
771 return connected_; 771 return connected_;
772 } 772 }
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 pending_write_callback_ = callback; 1303 pending_write_callback_ = callback;
1304 return ERR_IO_PENDING; 1304 return ERR_IO_PENDING;
1305 } 1305 }
1306 if (write_result.mode == ASYNC) { 1306 if (write_result.mode == ASYNC) {
1307 RunCallbackAsync(callback, write_result.result); 1307 RunCallbackAsync(callback, write_result.result);
1308 return ERR_IO_PENDING; 1308 return ERR_IO_PENDING;
1309 } 1309 }
1310 return write_result.result; 1310 return write_result.result;
1311 } 1311 }
1312 1312
1313 int MockUDPClientSocket::SetReceiveBufferSize(int32 size) { 1313 int MockUDPClientSocket::SetReceiveBufferSize(int32_t size) {
1314 return OK; 1314 return OK;
1315 } 1315 }
1316 1316
1317 int MockUDPClientSocket::SetSendBufferSize(int32 size) { 1317 int MockUDPClientSocket::SetSendBufferSize(int32_t size) {
1318 return OK; 1318 return OK;
1319 } 1319 }
1320 1320
1321 void MockUDPClientSocket::Close() { 1321 void MockUDPClientSocket::Close() {
1322 connected_ = false; 1322 connected_ = false;
1323 } 1323 }
1324 1324
1325 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const { 1325 int MockUDPClientSocket::GetPeerAddress(IPEndPoint* address) const {
1326 *address = peer_addr_; 1326 *address = peer_addr_;
1327 return OK; 1327 return OK;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } 1695 }
1696 1696
1697 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { 1697 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) {
1698 int64_t total = 0; 1698 int64_t total = 0;
1699 for (const MockWrite* write = writes; write != writes + writes_size; ++write) 1699 for (const MockWrite* write = writes; write != writes + writes_size; ++write)
1700 total += write->data_len; 1700 total += write->data_len;
1701 return total; 1701 return total;
1702 } 1702 }
1703 1703
1704 } // namespace net 1704 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks5_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698