#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/socket/unix_domain_client_socket_posix.h"
#include <unistd.h>
#include <memory>
#include <utility>
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/posix/eintr_wrapper.h"
#include "build/build_config.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/sockaddr_storage.h"
#include "net/base/sockaddr_util_posix.h"
#include "net/base/test_completion_callback.h"
#include "net/socket/socket_posix.h"
#include "net/socket/unix_domain_server_socket_posix.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
IsError;
IsOk;
namespace net {
namespace {
const char kSocketFilename[] = …;
bool UserCanConnectCallback(
bool allow_user, const UnixDomainServerSocket::Credentials& credentials) { … }
UnixDomainServerSocket::AuthCallback CreateAuthCallback(bool allow_user) { … }
int ConnectSynchronously(StreamSocket* socket) { … }
int ReadSynchronously(StreamSocket* socket,
IOBuffer* buf,
int buf_len,
int min_data_len) { … }
int WriteSynchronously(StreamSocket* socket,
IOBuffer* buf,
int buf_len) { … }
class UnixDomainClientSocketTest : public TestWithTaskEnvironment { … };
TEST_F(UnixDomainClientSocketTest, Connect) { … }
TEST_F(UnixDomainClientSocketTest, ConnectWithSocketDescriptor) { … }
TEST_F(UnixDomainClientSocketTest, ConnectWithAbstractNamespace) { … }
TEST_F(UnixDomainClientSocketTest, ConnectToNonExistentSocket) { … }
TEST_F(UnixDomainClientSocketTest,
ConnectToNonExistentSocketWithAbstractNamespace) { … }
TEST_F(UnixDomainClientSocketTest, DisconnectFromClient) { … }
TEST_F(UnixDomainClientSocketTest, DisconnectFromServer) { … }
TEST_F(UnixDomainClientSocketTest, ReadAfterWrite) { … }
TEST_F(UnixDomainClientSocketTest, ReadBeforeWrite) { … }
}
}