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

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

Issue 1892323002: Change scoped_ptr to std::unique_ptr in //net/socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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_server_socket_posix.h" 5 #include "net/socket/unix_domain_server_socket_posix.h"
6 6
7 #include <memory>
7 #include <vector> 8 #include <vector>
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/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "net/base/io_buffer.h" 15 #include "net/base/io_buffer.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/base/test_completion_callback.h" 17 #include "net/base/test_completion_callback.h"
18 #include "net/socket/unix_domain_client_socket_posix.h" 18 #include "net/socket/unix_domain_client_socket_posix.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace net { 21 namespace net {
22 namespace { 22 namespace {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 EXPECT_EQ(OK, server_socket.BindAndListen(socket_path_, /*backlog=*/1)); 79 EXPECT_EQ(OK, server_socket.BindAndListen(socket_path_, /*backlog=*/1));
80 } 80 }
81 81
82 TEST_F(UnixDomainServerSocketTest, AcceptWithForbiddenUser) { 82 TEST_F(UnixDomainServerSocketTest, AcceptWithForbiddenUser) {
83 const bool kUseAbstractNamespace = false; 83 const bool kUseAbstractNamespace = false;
84 84
85 UnixDomainServerSocket server_socket(CreateAuthCallback(false), 85 UnixDomainServerSocket server_socket(CreateAuthCallback(false),
86 kUseAbstractNamespace); 86 kUseAbstractNamespace);
87 EXPECT_EQ(OK, server_socket.BindAndListen(socket_path_, /*backlog=*/1)); 87 EXPECT_EQ(OK, server_socket.BindAndListen(socket_path_, /*backlog=*/1));
88 88
89 scoped_ptr<StreamSocket> accepted_socket; 89 std::unique_ptr<StreamSocket> accepted_socket;
90 TestCompletionCallback accept_callback; 90 TestCompletionCallback accept_callback;
91 EXPECT_EQ(ERR_IO_PENDING, 91 EXPECT_EQ(ERR_IO_PENDING,
92 server_socket.Accept(&accepted_socket, accept_callback.callback())); 92 server_socket.Accept(&accepted_socket, accept_callback.callback()));
93 EXPECT_FALSE(accepted_socket); 93 EXPECT_FALSE(accepted_socket);
94 94
95 UnixDomainClientSocket client_socket(socket_path_, kUseAbstractNamespace); 95 UnixDomainClientSocket client_socket(socket_path_, kUseAbstractNamespace);
96 EXPECT_FALSE(client_socket.IsConnected()); 96 EXPECT_FALSE(client_socket.IsConnected());
97 97
98 // Connect() will return OK before the server rejects the connection. 98 // Connect() will return OK before the server rejects the connection.
99 TestCompletionCallback connect_callback; 99 TestCompletionCallback connect_callback;
(...skipping 30 matching lines...) Expand all
130 0, 130 0,
131 /*backlog=*/1)); 131 /*backlog=*/1));
132 132
133 EXPECT_EQ(ERR_ADDRESS_INVALID, server_socket.GetLocalAddress(&ep)); 133 EXPECT_EQ(ERR_ADDRESS_INVALID, server_socket.GetLocalAddress(&ep));
134 } 134 }
135 135
136 // Normal cases including read/write are tested by UnixDomainClientSocketTest. 136 // Normal cases including read/write are tested by UnixDomainClientSocketTest.
137 137
138 } // namespace 138 } // namespace
139 } // namespace net 139 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/unix_domain_server_socket_posix.cc ('k') | net/socket/websocket_endpoint_lock_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698