OLD | NEW |
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 <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 UnixDomainServerSocket::AuthCallback CreateAuthCallback(bool allow_user) { | 43 UnixDomainServerSocket::AuthCallback CreateAuthCallback(bool allow_user) { |
44 return base::Bind(&UserCanConnectCallback, allow_user); | 44 return base::Bind(&UserCanConnectCallback, allow_user); |
45 } | 45 } |
46 | 46 |
47 class UnixDomainServerSocketTest : public testing::Test { | 47 class UnixDomainServerSocketTest : public testing::Test { |
48 protected: | 48 protected: |
49 UnixDomainServerSocketTest() { | 49 UnixDomainServerSocketTest() { |
50 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 50 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
51 socket_path_ = temp_dir_.path().Append(kSocketFilename).value(); | 51 socket_path_ = temp_dir_.GetPath().Append(kSocketFilename).value(); |
52 } | 52 } |
53 | 53 |
54 base::ScopedTempDir temp_dir_; | 54 base::ScopedTempDir temp_dir_; |
55 std::string socket_path_; | 55 std::string socket_path_; |
56 }; | 56 }; |
57 | 57 |
58 TEST_F(UnixDomainServerSocketTest, ListenWithInvalidPath) { | 58 TEST_F(UnixDomainServerSocketTest, ListenWithInvalidPath) { |
59 const bool kUseAbstractNamespace = false; | 59 const bool kUseAbstractNamespace = false; |
60 UnixDomainServerSocket server_socket(CreateAuthCallback(true), | 60 UnixDomainServerSocket server_socket(CreateAuthCallback(true), |
61 kUseAbstractNamespace); | 61 kUseAbstractNamespace); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 0, | 136 0, |
137 /*backlog=*/1)); | 137 /*backlog=*/1)); |
138 | 138 |
139 EXPECT_THAT(server_socket.GetLocalAddress(&ep), IsError(ERR_ADDRESS_INVALID)); | 139 EXPECT_THAT(server_socket.GetLocalAddress(&ep), IsError(ERR_ADDRESS_INVALID)); |
140 } | 140 } |
141 | 141 |
142 // Normal cases including read/write are tested by UnixDomainClientSocketTest. | 142 // Normal cases including read/write are tested by UnixDomainClientSocketTest. |
143 | 143 |
144 } // namespace | 144 } // namespace |
145 } // namespace net | 145 } // namespace net |
OLD | NEW |