#include "third_party/blink/renderer/modules/direct_sockets/udp_readable_stream_wrapper.h"
#include "base/containers/span.h"
#include "base/functional/callback_helpers.h"
#include "base/notreached.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/net_errors.h"
#include "services/network/public/mojom/restricted_udp_socket.mojom-blink.h"
#include "services/network/public/mojom/udp_socket.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/iterable.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_tester.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_udp_message.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_piece.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/modules/direct_sockets/stream_wrapper.h"
#include "third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_receiver.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/gc_plugin.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_uchar.h"
#include "third_party/blink/renderer/platform/wtf/wtf_size_t.h"
namespace blink {
namespace {
class FakeRestrictedUDPSocket final
: public GarbageCollected<FakeRestrictedUDPSocket>,
public network::mojom::blink::RestrictedUDPSocket { … };
class StreamCreator : public GarbageCollected<StreamCreator> { … };
class ScopedStreamCreator { … };
std::pair<UDPMessage*, bool> UnpackPromiseResult(const V8TestingScope& scope,
v8::Local<v8::Value> result) { … }
String UDPMessageDataToString(const UDPMessage* message) { … }
TEST(UDPReadableStreamWrapperTest, Create) { … }
TEST(UDPReadableStreamWrapperTest, ReadUdpMessage) { … }
TEST(UDPReadableStreamWrapperTest, ReadDelayedUdpMessage) { … }
TEST(UDPReadableStreamWrapperTest, ReadEmptyUdpMessage) { … }
TEST(UDPReadableStreamWrapperTest, CancelStreamFromReader) { … }
TEST(UDPReadableStreamWrapperTest, ReadRejectsOnError) { … }
}
}