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_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 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 write_buf->DidConsume(rv); | 118 write_buf->DidConsume(rv); |
119 } | 119 } |
120 EXPECT_LE(0, write_buf->BytesRemaining()); | 120 EXPECT_LE(0, write_buf->BytesRemaining()); |
121 return write_buf->BytesConsumed(); | 121 return write_buf->BytesConsumed(); |
122 } | 122 } |
123 | 123 |
124 class UnixDomainClientSocketTest : public testing::Test { | 124 class UnixDomainClientSocketTest : public testing::Test { |
125 protected: | 125 protected: |
126 UnixDomainClientSocketTest() { | 126 UnixDomainClientSocketTest() { |
127 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 127 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
128 socket_path_ = temp_dir_.path().Append(kSocketFilename).value(); | 128 socket_path_ = temp_dir_.GetPath().Append(kSocketFilename).value(); |
129 } | 129 } |
130 | 130 |
131 base::ScopedTempDir temp_dir_; | 131 base::ScopedTempDir temp_dir_; |
132 std::string socket_path_; | 132 std::string socket_path_; |
133 }; | 133 }; |
134 | 134 |
135 TEST_F(UnixDomainClientSocketTest, Connect) { | 135 TEST_F(UnixDomainClientSocketTest, Connect) { |
136 const bool kUseAbstractNamespace = false; | 136 const bool kUseAbstractNamespace = false; |
137 | 137 |
138 UnixDomainServerSocket server_socket(CreateAuthCallback(true), | 138 UnixDomainServerSocket server_socket(CreateAuthCallback(true), |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 accepted_socket.get(), read_buffer.get(), kReadBufferSize, 0)); | 449 accepted_socket.get(), read_buffer.get(), kReadBufferSize, 0)); |
450 | 450 |
451 // Disconnect from server side after read-write. | 451 // Disconnect from server side after read-write. |
452 accepted_socket->Disconnect(); | 452 accepted_socket->Disconnect(); |
453 EXPECT_FALSE(accepted_socket->IsConnected()); | 453 EXPECT_FALSE(accepted_socket->IsConnected()); |
454 EXPECT_FALSE(client_socket.IsConnected()); | 454 EXPECT_FALSE(client_socket.IsConnected()); |
455 } | 455 } |
456 | 456 |
457 } // namespace | 457 } // namespace |
458 } // namespace net | 458 } // namespace net |
OLD | NEW |