#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/dns/address_sorter_posix.h"
#include <memory>
#include <string>
#include <vector>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/network_change_notifier.h"
#include "net/base/test_completion_callback.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/client_socket_factory.h"
#include "net/socket/datagram_client_socket.h"
#include "net/socket/socket_performance_watcher.h"
#include "net/socket/ssl_client_socket.h"
#include "net/socket/stream_socket.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
namespace {
AddressMapping;
IPAddress ParseIP(const std::string& str) { … }
class TestUDPClientSocket : public DatagramClientSocket { … };
class TestSocketFactory : public ClientSocketFactory { … };
void OnSortComplete(bool& completed,
std::vector<IPEndPoint>* sorted_buf,
CompletionOnceCallback callback,
bool success,
std::vector<IPEndPoint> sorted) { … }
}
class AddressSorterPosixTest : public TestWithTaskEnvironment { … };
class AddressSorterPosixSyncOrAsyncTest
: public AddressSorterPosixTest,
public testing::WithParamInterface<TestUDPClientSocket::ConnectMode> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule1) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule2) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule3) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule4) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule5) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule6) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule7) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule8) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule9) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, Rule10) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, MultipleRules) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, InputPortsAreMaintained) { … }
TEST_P(AddressSorterPosixSyncOrAsyncTest, AddressSorterPosixDestroyed) { … }
TEST_F(AddressSorterPosixTest, RandomAsyncSocketOrder) { … }
TEST_F(AddressSorterPosixTest, IPAddressChangedSort) { … }
}