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

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

Issue 1481403005: Fix size_t truncations in net for 64-bit VS 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback 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/server/web_socket_encoder.cc ('k') | no next file » | 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/socks5_client_socket.h" 5 #include "net/socket/socks5_client_socket.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 TEST_F(SOCKS5ClientSocketTest, ConnectAndDisconnectTwice) { 187 TEST_F(SOCKS5ClientSocketTest, ConnectAndDisconnectTwice) {
188 const std::string hostname = "my-host-name"; 188 const std::string hostname = "my-host-name";
189 const char kSOCKS5DomainRequest[] = { 189 const char kSOCKS5DomainRequest[] = {
190 0x05, // VER 190 0x05, // VER
191 0x01, // CMD 191 0x01, // CMD
192 0x00, // RSV 192 0x00, // RSV
193 0x03, // ATYPE 193 0x03, // ATYPE
194 }; 194 };
195 195
196 std::string request(kSOCKS5DomainRequest, arraysize(kSOCKS5DomainRequest)); 196 std::string request(kSOCKS5DomainRequest, arraysize(kSOCKS5DomainRequest));
197 request.push_back(hostname.size()); 197 request.push_back(static_cast<char>(hostname.size()));
198 request.append(hostname); 198 request.append(hostname);
199 request.append(reinterpret_cast<const char*>(&kNwPort), sizeof(kNwPort)); 199 request.append(reinterpret_cast<const char*>(&kNwPort), sizeof(kNwPort));
200 200
201 for (int i = 0; i < 2; ++i) { 201 for (int i = 0; i < 2; ++i) {
202 MockWrite data_writes[] = { 202 MockWrite data_writes[] = {
203 MockWrite(SYNCHRONOUS, kSOCKS5GreetRequest, kSOCKS5GreetRequestLength), 203 MockWrite(SYNCHRONOUS, kSOCKS5GreetRequest, kSOCKS5GreetRequestLength),
204 MockWrite(SYNCHRONOUS, request.data(), request.size()) 204 MockWrite(SYNCHRONOUS, request.data(), request.size())
205 }; 205 };
206 MockRead data_reads[] = { 206 MockRead data_reads[] = {
207 MockRead(SYNCHRONOUS, kSOCKS5GreetResponse, kSOCKS5GreetResponseLength), 207 MockRead(SYNCHRONOUS, kSOCKS5GreetResponse, kSOCKS5GreetResponseLength),
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 EXPECT_TRUE(user_sock_->IsConnected()); 372 EXPECT_TRUE(user_sock_->IsConnected());
373 net_log_.GetEntries(&net_log_entries); 373 net_log_.GetEntries(&net_log_entries);
374 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, 374 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1,
375 NetLog::TYPE_SOCKS5_CONNECT)); 375 NetLog::TYPE_SOCKS5_CONNECT));
376 } 376 }
377 } 377 }
378 378
379 } // namespace 379 } // namespace
380 380
381 } // namespace net 381 } // namespace net
OLDNEW
« no previous file with comments | « net/server/web_socket_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698