chromium/third_party/blink/renderer/core/fetch/body_stream_buffer_test.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/fetch/body_stream_buffer.h"

#include <memory>

#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.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_readable_stream.h"
#include "third_party/blink/renderer/core/dom/abort_controller.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/fetch/blob_bytes_consumer.h"
#include "third_party/blink/renderer/core/fetch/bytes_consumer_test_util.h"
#include "third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h"
#include "third_party/blink/renderer/core/html/forms/form_data.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/core/streams/readable_stream_default_controller_with_script_scope.h"
#include "third_party/blink/renderer/core/streams/test_underlying_source.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/blob/blob_url.h"
#include "third_party/blink/renderer/platform/blob/testing/fake_blob.h"
#include "third_party/blink/renderer/platform/blob/testing/fake_blob_registry.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h"
#include "third_party/blink/renderer/platform/loader/fetch/cached_metadata.h"
#include "third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h"
#include "third_party/blink/renderer/platform/network/encoded_form_data.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.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 {

InSequence;
Return;
_;
SaveArg;
Checkpoint;
MockFetchDataLoaderClient;

class BodyStreamBufferTest : public testing::Test {};

class MockFetchDataLoader : public FetchDataLoader {};

TEST_F(BodyStreamBufferTest, Tee) {}

TEST_F(BodyStreamBufferTest, TeeFromHandleMadeFromStream) {}

TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandle) {}

TEST_F(BodyStreamBufferTest, DrainAsBlobDataHandleReturnsNull) {}

TEST_F(BodyStreamBufferTest,
       DrainAsBlobFromBufferMadeFromBufferMadeFromStream) {}

TEST_F(BodyStreamBufferTest, DrainAsFormData) {}

TEST_F(BodyStreamBufferTest, DrainAsFormDataReturnsNull) {}

TEST_F(BodyStreamBufferTest,
       DrainAsFormDataFromBufferMadeFromBufferMadeFromStream) {}

TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsArrayBuffer) {}

class BodyStreamBufferBlobTest : public BodyStreamBufferTest {};

TEST_F(BodyStreamBufferBlobTest, LoadBodyStreamBufferAsBlob) {}

TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsString) {}

TEST_F(BodyStreamBufferTest, LoadClosedHandle) {}

TEST_F(BodyStreamBufferTest, LoadErroredHandle) {}

TEST_F(BodyStreamBufferTest, LoaderShouldBeKeptAliveByBodyStreamBuffer) {}

TEST_F(BodyStreamBufferTest, SourceShouldBeCanceledWhenCanceled) {}

TEST_F(BodyStreamBufferTest, NestedPull) {}

TEST_F(BodyStreamBufferTest, NullAbortSignalIsNotAborted) {}

TEST_F(BodyStreamBufferTest, AbortSignalMakesAborted) {}

TEST_F(BodyStreamBufferTest,
       AbortBeforeStartLoadingCallsDataLoaderClientAbort) {}

TEST_F(BodyStreamBufferTest, AbortAfterStartLoadingCallsDataLoaderClientAbort) {}

TEST_F(BodyStreamBufferTest,
       AsyncAbortAfterStartLoadingCallsDataLoaderClientAbort) {}

TEST_F(BodyStreamBufferTest, CachedMetadataHandler) {}

TEST_F(BodyStreamBufferTest, CachedMetadataHandlerAndTee) {}

TEST_F(BodyStreamBufferTest,
       CachedMetadataHandlerAndTeeForBufferMadeFromStream) {}

TEST_F(BodyStreamBufferTest, TakeSideDataBlob) {}

TEST_F(BodyStreamBufferTest, KeptAliveWhileLoading) {}

}  // namespace

}  // namespace blink