chromium/third_party/blink/renderer/modules/webtransport/outgoing_stream_test.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/webtransport/outgoing_stream.h"

#include <utility>

#include "base/containers/span.h"
#include "base/ranges/algorithm.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/task_type.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/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.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_typed_array.h"
#include "third_party/blink/renderer/modules/webtransport/web_transport_error.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 "v8/include/v8.h"

namespace blink {

namespace {

ElementsAre;
StrictMock;

class MockClient : public GarbageCollected<MockClient>,
                   public OutgoingStream::Client {};

// The purpose of this class is to ensure that the data pipe is reset before the
// V8TestingScope is destroyed, so that the OutgoingStream object doesn't try to
// create a DOMException after the ScriptState has gone away.
class StreamCreator {};

TEST(OutgoingStreamTest, Create) {}

TEST(OutgoingStreamTest, WriteArrayBuffer) {}

TEST(OutgoingStreamTest, WriteArrayBufferView) {}

bool IsAllNulls(base::span<const uint8_t> data) {}

TEST(OutgoingStreamTest, AsyncWrite) {}

// Writing immediately followed by closing should not lose data.
TEST(OutgoingStreamTest, WriteThenClose) {}

TEST(OutgoingStreamTest, DataPipeClosed) {}

TEST(OutgoingStreamTest, DataPipeClosedDuringAsyncWrite) {}

TEST(OutgoingStreamTest, Abort) {}

TEST(OutgoingStreamTest, AbortWithWebTransportError) {}

TEST(OutgoingStreamTest, AbortWithWebTransportErrorWithCode) {}

TEST(OutgoingStreamTest, CloseAndConnectionError) {}

}  // namespace

}  // namespace blink