#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <stdint.h>
#include <limits>
#include <utility>
#include "services/network/udp_socket.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/net_errors.h"
#include "net/socket/udp_socket.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/public/mojom/udp_socket.mojom.h"
#include "services/network/socket_factory.h"
#include "services/network/test/udp_socket_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
const size_t kDatagramSize = …;
class SocketWrapperTestImpl : public UDPSocket::SocketWrapper { … };
net::IPEndPoint GetLocalHostWithAnyPort() { … }
std::vector<uint8_t> CreateTestMessage(uint8_t initial, size_t size) { … }
class HangingUDPSocket : public SocketWrapperTestImpl { … };
class ZeroByteReadUDPSocket : public SocketWrapperTestImpl { … };
}
class UDPSocketTest : public testing::Test { … };
TEST_F(UDPSocketTest, Settings) { … }
TEST_F(UDPSocketTest, TestSendWithBind) { … }
TEST_F(UDPSocketTest, TestSendToWithConnect) { … }
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_TestReadSendTo …
#define MAYBE_TestUnexpectedSequences …
#else
#define MAYBE_TestReadSendTo …
#define MAYBE_TestUnexpectedSequences …
#endif
TEST_F(UDPSocketTest, MAYBE_TestUnexpectedSequences) { … }
TEST_F(UDPSocketTest, TestBufferValid) { … }
TEST_F(UDPSocketTest, TestInsufficientResources) { … }
TEST_F(UDPSocketTest, TestReceiveMoreOverflow) { … }
TEST_F(UDPSocketTest, TestReadSend) { … }
TEST_F(UDPSocketTest, MAYBE_TestReadSendTo) { … }
TEST_F(UDPSocketTest, TestReceiveMoreWithBufferSize) { … }
TEST_F(UDPSocketTest, TestSendToInvalidAddress) { … }
TEST_F(UDPSocketTest, TestReadZeroByte) { … }
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_JoinMulticastGroup …
#else
#define MAYBE_JoinMulticastGroup …
#endif
TEST_F(UDPSocketTest, MAYBE_JoinMulticastGroup) { … }
TEST_F(UDPSocketTest, ErrorHappensDuringSocketOptionsConfiguration) { … }
}