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

Side by Side Diff: net/socket/unix_domain_client_socket_posix_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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/unix_domain_client_socket_posix.h" 5 #include "net/socket/unix_domain_client_socket_posix.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/posix/eintr_wrapper.h" 14 #include "base/posix/eintr_wrapper.h"
14 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
16 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
17 #include "net/base/test_completion_callback.h" 18 #include "net/base/test_completion_callback.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 179
179 SocketDescriptor client_socket_fd = client_socket.ReleaseConnectedSocket(); 180 SocketDescriptor client_socket_fd = client_socket.ReleaseConnectedSocket();
180 EXPECT_NE(kInvalidSocket, client_socket_fd); 181 EXPECT_NE(kInvalidSocket, client_socket_fd);
181 182
182 // Now, re-wrap client_socket_fd in a UnixDomainClientSocket and try a read 183 // Now, re-wrap client_socket_fd in a UnixDomainClientSocket and try a read
183 // to be sure it hasn't gotten accidentally closed. 184 // to be sure it hasn't gotten accidentally closed.
184 SockaddrStorage addr; 185 SockaddrStorage addr;
185 ASSERT_TRUE(UnixDomainClientSocket::FillAddress(socket_path_, false, &addr)); 186 ASSERT_TRUE(UnixDomainClientSocket::FillAddress(socket_path_, false, &addr));
186 scoped_ptr<SocketPosix> adopter(new SocketPosix); 187 scoped_ptr<SocketPosix> adopter(new SocketPosix);
187 adopter->AdoptConnectedSocket(client_socket_fd, addr); 188 adopter->AdoptConnectedSocket(client_socket_fd, addr);
188 UnixDomainClientSocket rewrapped_socket(adopter.Pass()); 189 UnixDomainClientSocket rewrapped_socket(std::move(adopter));
189 EXPECT_TRUE(rewrapped_socket.IsConnected()); 190 EXPECT_TRUE(rewrapped_socket.IsConnected());
190 191
191 // Try to read data. 192 // Try to read data.
192 const int kReadDataSize = 10; 193 const int kReadDataSize = 10;
193 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadDataSize)); 194 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadDataSize));
194 TestCompletionCallback read_callback; 195 TestCompletionCallback read_callback;
195 EXPECT_EQ(ERR_IO_PENDING, 196 EXPECT_EQ(ERR_IO_PENDING,
196 rewrapped_socket.Read( 197 rewrapped_socket.Read(
197 read_buffer.get(), kReadDataSize, read_callback.callback())); 198 read_buffer.get(), kReadDataSize, read_callback.callback()));
198 199
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 accepted_socket.get(), read_buffer.get(), kReadBufferSize, 0)); 439 accepted_socket.get(), read_buffer.get(), kReadBufferSize, 0));
439 440
440 // Disconnect from server side after read-write. 441 // Disconnect from server side after read-write.
441 accepted_socket->Disconnect(); 442 accepted_socket->Disconnect();
442 EXPECT_FALSE(accepted_socket->IsConnected()); 443 EXPECT_FALSE(accepted_socket->IsConnected());
443 EXPECT_FALSE(client_socket.IsConnected()); 444 EXPECT_FALSE(client_socket.IsConnected());
444 } 445 }
445 446
446 } // namespace 447 } // namespace
447 } // namespace net 448 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/unix_domain_client_socket_posix.cc ('k') | net/socket/unix_domain_server_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698