| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Connect() will return OK before the server rejects the connection. | 90 // Connect() will return OK before the server rejects the connection. |
| 91 TestCompletionCallback connect_callback; | 91 TestCompletionCallback connect_callback; |
| 92 int rv = connect_callback.GetResult( | 92 int rv = connect_callback.GetResult( |
| 93 client_socket.Connect(connect_callback.callback())); | 93 client_socket.Connect(connect_callback.callback())); |
| 94 ASSERT_EQ(OK, rv); | 94 ASSERT_EQ(OK, rv); |
| 95 | 95 |
| 96 // Try to read from the socket. | 96 // Try to read from the socket. |
| 97 const int read_buffer_size = 10; | 97 const int read_buffer_size = 10; |
| 98 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(read_buffer_size)); | 98 scoped_refptr<IOBuffer> read_buffer(new IOBuffer(read_buffer_size)); |
| 99 TestCompletionCallback read_callback; | 99 TestCompletionCallback read_callback; |
| 100 rv = read_callback.GetResult(client_socket.Read(read_buffer, read_buffer_size, | 100 rv = read_callback.GetResult(client_socket.Read( |
| 101 read_callback.callback())); | 101 read_buffer.get(), read_buffer_size, read_callback.callback())); |
| 102 | 102 |
| 103 // The server should have disconnected gracefully, without sending any data. | 103 // The server should have disconnected gracefully, without sending any data. |
| 104 ASSERT_EQ(0, rv); | 104 ASSERT_EQ(0, rv); |
| 105 EXPECT_FALSE(client_socket.IsConnected()); | 105 EXPECT_FALSE(client_socket.IsConnected()); |
| 106 | 106 |
| 107 // The server socket should not have called |accept_callback| or modified | 107 // The server socket should not have called |accept_callback| or modified |
| 108 // |accepted_socket|. | 108 // |accepted_socket|. |
| 109 EXPECT_FALSE(accept_callback.have_result()); | 109 EXPECT_FALSE(accept_callback.have_result()); |
| 110 EXPECT_FALSE(accepted_socket); | 110 EXPECT_FALSE(accepted_socket); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Normal cases including read/write are tested by UnixDomainClientSocketTest. | 113 // Normal cases including read/write are tested by UnixDomainClientSocketTest. |
| 114 | 114 |
| 115 } // namespace | 115 } // namespace |
| 116 } // namespace net | 116 } // namespace net |
| OLD | NEW |