#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/webtransport/web_transport.h"
#include <array>
#include <memory>
#include <optional>
#include <utility>
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/test/mock_callback.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/network/public/mojom/web_transport.mojom-blink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/webtransport/web_transport_connector.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/bindings/core/v8/iterable.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_tester.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_dom_exception.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_readable_stream.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_writable_stream.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_transport_bidirectional_stream.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_transport_close_info.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_transport_error.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_transport_hash.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_web_transport_options.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/core/streams/readable_stream_byob_reader.h"
#include "third_party/blink/renderer/core/streams/readable_stream_default_reader.h"
#include "third_party/blink/renderer/core/streams/writable_stream.h"
#include "third_party/blink/renderer/core/streams/writable_stream_default_writer.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/modules/webtransport/bidirectional_stream.h"
#include "third_party/blink/renderer/modules/webtransport/datagram_duplex_stream.h"
#include "third_party/blink/renderer/modules/webtransport/receive_stream.h"
#include "third_party/blink/renderer/modules/webtransport/send_stream.h"
#include "third_party/blink/renderer/modules/webtransport/test_utils.h"
#include "third_party/blink/renderer/modules/webtransport/web_transport_error.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.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/heap/persistent.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/deque.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "v8/include/v8.h"
namespace blink {
namespace {
_;
ElementsAre;
Invoke;
Mock;
StrictMock;
Truly;
Unused;
class WebTransportConnector final : public mojom::blink::WebTransportConnector { … };
class MockWebTransport : public network::mojom::blink::WebTransport { … };
class WebTransportTest : public ::testing::Test { … };
TEST_F(WebTransportTest, FailWithNullURL) { … }
TEST_F(WebTransportTest, FailWithEmptyURL) { … }
TEST_F(WebTransportTest, FailWithNoScheme) { … }
TEST_F(WebTransportTest, FailWithHttpsURL) { … }
TEST_F(WebTransportTest, FailWithNoHost) { … }
TEST_F(WebTransportTest, FailWithURLFragment) { … }
TEST_F(WebTransportTest, FailByCSP) { … }
TEST_F(WebTransportTest, PassCSP) { … }
TEST_F(WebTransportTest, SendConnect) { … }
TEST_F(WebTransportTest, SuccessfulConnect) { … }
TEST_F(WebTransportTest, FailedConnect) { … }
TEST_F(WebTransportTest, SendConnectWithFingerprint) { … }
TEST_F(WebTransportTest, SendConnectWithArrayBufferHash) { … }
TEST_F(WebTransportTest, SendConnectWithOffsetArrayBufferViewHash) { … }
TEST_F(WebTransportTest, SendConnectWithInvalidFingerprint) { … }
TEST_F(WebTransportTest, CloseDuringConnect) { … }
TEST_F(WebTransportTest, CloseAfterConnection) { … }
TEST_F(WebTransportTest, CloseWithNull) { … }
TEST_F(WebTransportTest, CloseWithReasonOnly) { … }
TEST_F(WebTransportTest, GarbageCollection) { … }
TEST_F(WebTransportTest, GarbageCollectMojoConnectionError) { … }
TEST_F(WebTransportTest, SendDatagram) { … }
TEST_F(WebTransportTest, BackpressureForOutgoingDatagrams) { … }
TEST_F(WebTransportTest, SendDatagramBeforeConnect) { … }
TEST_F(WebTransportTest, SendDatagramAfterClose) { … }
Vector<uint8_t> GetValueAsVector(ScriptState* script_state,
ScriptValue iterator_result) { … }
TEST_F(WebTransportTest, ReceiveDatagramBeforeRead) { … }
TEST_F(WebTransportTest, ReceiveDatagramDuringRead) { … }
TEST_F(WebTransportTest, ReceiveDatagramWithBYOBReader) { … }
bool IsRangeError(ScriptState* script_state,
ScriptValue value,
const String& message) { … }
TEST_F(WebTransportTest, ReceiveDatagramWithoutEnoughBuffer) { … }
TEST_F(WebTransportTest, CancelDatagramReadableWorks) { … }
TEST_F(WebTransportTest, DatagramsShouldBeErroredAfterClose) { … }
TEST_F(WebTransportTest, ResettingIncomingHighWaterMarkWorksAfterClose) { … }
TEST_F(WebTransportTest, TransportErrorErrorsReadableStream) { … }
TEST_F(WebTransportTest, DatagramsAreDropped) { … }
TEST_F(WebTransportTest, IncomingHighWaterMarkIsObeyed) { … }
TEST_F(WebTransportTest, ResettingHighWaterMarkClearsQueue) { … }
TEST_F(WebTransportTest, ReadIncomingDatagramWorksWithHighWaterMarkZero) { … }
TEST_F(WebTransportTest, IncomingMaxAgeIsObeyed) { … }
TEST_F(WebTransportTest, TwoSimultaneousReadsWork) { … }
bool ValidProducerHandle(const mojo::ScopedDataPipeProducerHandle& handle) { … }
bool ValidConsumerHandle(const mojo::ScopedDataPipeConsumerHandle& handle) { … }
TEST_F(WebTransportTest, CreateSendStream) { … }
TEST_F(WebTransportTest, CreateSendStreamBeforeConnect) { … }
TEST_F(WebTransportTest, CreateSendStreamFailure) { … }
TEST_F(WebTransportTest, SendStreamGarbageCollection) { … }
TEST_F(WebTransportTest, SendStreamGarbageCollectionLocalClose) { … }
TEST_F(WebTransportTest, SendStreamGarbageCollectionRemoteClose) { … }
TEST_F(WebTransportTest, ReceiveStreamGarbageCollectionCancel) { … }
TEST_F(WebTransportTest, ReceiveStreamGarbageCollectionRemoteClose) { … }
TEST_F(WebTransportTest, ReceiveStreamGarbageCollectionRemoteCloseReverse) { … }
TEST_F(WebTransportTest, CreateSendStreamAbortedByClose) { … }
TEST_F(WebTransportTest, CreateReceiveStream) { … }
TEST_F(WebTransportTest, CreateReceiveStreamThenClose) { … }
TEST_F(WebTransportTest, CreateReceiveStreamThenRemoteClose) { … }
TEST_F(WebTransportTest, CreateBidirectionalStream) { … }
TEST_F(WebTransportTest, ReceiveBidirectionalStream) { … }
TEST_F(WebTransportTest, SetDatagramWritableQueueExpirationDuration) { … }
TEST_F(WebTransportTest, SetOutgoingMaxAgeBeforeConnectComplete) { … }
TEST_F(WebTransportTest, OnClosed) { … }
TEST_F(WebTransportTest, ClosedAccessorCalledAfterOnClosed) { … }
TEST_F(WebTransportTest, OnClosedWithNull) { … }
TEST_F(WebTransportTest, ReceivedResetStream) { … }
TEST_F(WebTransportTest, ReceivedStopSending) { … }
}
}