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

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

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « net/socket/socks5_client_socket.cc ('k') | net/socket/socks_client_socket.cc » ('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/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 #include <utility>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/sys_byteorder.h" 13 #include "base/sys_byteorder.h"
13 #include "net/base/address_list.h" 14 #include "net/base/address_list.h"
14 #include "net/base/test_completion_callback.h" 15 #include "net/base/test_completion_callback.h"
15 #include "net/base/winsock_init.h" 16 #include "net/base/winsock_init.h"
16 #include "net/dns/mock_host_resolver.h" 17 #include "net/dns/mock_host_resolver.h"
17 #include "net/log/net_log.h" 18 #include "net/log/net_log.h"
18 #include "net/log/test_net_log.h" 19 #include "net/log/test_net_log.h"
19 #include "net/log/test_net_log_entry.h" 20 #include "net/log/test_net_log_entry.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 EXPECT_EQ(ERR_IO_PENDING, rv); 102 EXPECT_EQ(ERR_IO_PENDING, rv);
102 rv = callback.WaitForResult(); 103 rv = callback.WaitForResult();
103 EXPECT_EQ(OK, rv); 104 EXPECT_EQ(OK, rv);
104 EXPECT_TRUE(tcp_sock_->IsConnected()); 105 EXPECT_TRUE(tcp_sock_->IsConnected());
105 106
106 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); 107 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
107 // |connection| takes ownership of |tcp_sock_|, but keep a 108 // |connection| takes ownership of |tcp_sock_|, but keep a
108 // non-owning pointer to it. 109 // non-owning pointer to it.
109 connection->SetSocket(scoped_ptr<StreamSocket>(tcp_sock_)); 110 connection->SetSocket(scoped_ptr<StreamSocket>(tcp_sock_));
110 return scoped_ptr<SOCKS5ClientSocket>(new SOCKS5ClientSocket( 111 return scoped_ptr<SOCKS5ClientSocket>(new SOCKS5ClientSocket(
111 connection.Pass(), 112 std::move(connection),
112 HostResolver::RequestInfo(HostPortPair(hostname, port)))); 113 HostResolver::RequestInfo(HostPortPair(hostname, port))));
113 } 114 }
114 115
115 // Tests a complete SOCKS5 handshake and the disconnection. 116 // Tests a complete SOCKS5 handshake and the disconnection.
116 TEST_F(SOCKS5ClientSocketTest, CompleteHandshake) { 117 TEST_F(SOCKS5ClientSocketTest, CompleteHandshake) {
117 const std::string payload_write = "random data"; 118 const std::string payload_write = "random data";
118 const std::string payload_read = "moar random data"; 119 const std::string payload_read = "moar random data";
119 120
120 const char kOkRequest[] = { 121 const char kOkRequest[] = {
121 0x05, // Version 122 0x05, // Version
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 EXPECT_TRUE(user_sock_->IsConnected()); 374 EXPECT_TRUE(user_sock_->IsConnected());
374 net_log_.GetEntries(&net_log_entries); 375 net_log_.GetEntries(&net_log_entries);
375 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, 376 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1,
376 NetLog::TYPE_SOCKS5_CONNECT)); 377 NetLog::TYPE_SOCKS5_CONNECT));
377 } 378 }
378 } 379 }
379 380
380 } // namespace 381 } // namespace
381 382
382 } // namespace net 383 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks5_client_socket.cc ('k') | net/socket/socks_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698