chromium/third_party/blink/renderer/modules/direct_sockets/tcp_readable_stream_wrapper_unittest.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/direct_sockets/tcp_readable_stream_wrapper.h"

#include "base/containers/span.h"
#include "base/functional/callback_helpers.h"
#include "base/test/mock_callback.h"
#include "net/base/net_errors.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/v8_binding_for_testing.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/modules/direct_sockets/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/testing/task_environment.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"

namespace blink {

namespace {

ElementsAre;

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

class ScopedStreamCreator {};

TEST(TCPReadableStreamWrapperTest, Create) {}

TEST(TCPReadableStreamWrapperTest, ReadArrayBuffer) {}

TEST(TCPReadableStreamWrapperTest, WriteToPipeWithPendingRead) {}

class TCPReadableStreamWrapperCloseTest : public testing::TestWithParam<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(TCPReadableStreamWrapperCloseTest, TriggerClose) {}

TEST_P(TCPReadableStreamWrapperCloseTest, TriggerCloseInReverseOrder) {}

TEST_P(TCPReadableStreamWrapperCloseTest, ErrorCancelReset) {}

TEST_P(TCPReadableStreamWrapperCloseTest, ResetCancelError) {}

}  // namespace

}  // namespace blink