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

// Copyright 2016 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/form_data_bytes_consumer.h"

#include "base/containers/span.h"
#include "base/memory/scoped_refptr.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "services/network/public/mojom/data_pipe_getter.mojom-blink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_http_body.h"
#include "third_party/blink/renderer/core/fetch/bytes_consumer_test_util.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/forms/form_data.h"
#include "third_party/blink/renderer/core/testing/file_backed_blob_factory_test_helper.h"
#include "third_party/blink/renderer/core/testing/page_test_base.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/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/loader/testing/bytes_consumer_test_reader.h"
#include "third_party/blink/renderer/platform/network/encoded_form_data.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"

namespace blink {
namespace {

Result;
_;
DoAll;
InSequence;
Return;
Checkpoint;
MockBytesConsumer;

class SimpleDataPipeGetter : public network::mojom::blink::DataPipeGetter {};

scoped_refptr<EncodedFormData> ComplexFormData() {}

scoped_refptr<EncodedFormData> DataPipeFormData() {}

class NoopClient final : public GarbageCollected<NoopClient>,
                         public BytesConsumer::Client {};

class FormDataBytesConsumerTest : public PageTestBase {};

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromString) {}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromStringNonLatin) {}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromArrayBuffer) {}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromArrayBufferView) {}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromSimpleFormData) {}

TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromComplexFormData) {}

TEST_F(FormDataBytesConsumerTest, EndReadCanReturnDone) {}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromString) {}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromArrayBuffer) {}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromSimpleFormData) {}

TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromComplexFormData) {}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromString) {}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromArrayBuffer) {}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromSimpleFormData) {}

TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromComplexFormData) {}

TEST_F(FormDataBytesConsumerTest, BeginReadAffectsDraining) {}

TEST_F(FormDataBytesConsumerTest, BeginReadAffectsDrainingWithComplexFormData) {}

TEST_F(FormDataBytesConsumerTest, SetClientWithComplexFormData) {}

TEST_F(FormDataBytesConsumerTest, CancelWithComplexFormData) {}

// Tests consuming an EncodedFormData with data pipe elements.
TEST_F(FormDataBytesConsumerTest, DataPipeFormData) {}

// Tests DrainAsFormData() on an EncodedFormData with data pipe elements.
TEST_F(FormDataBytesConsumerTest, DataPipeFormData_DrainAsFormData) {}

// Tests DrainAsFormData() on an EncodedFormData with data pipe elements after
// starting to read.
TEST_F(FormDataBytesConsumerTest,
       DataPipeFormData_DrainAsFormDataWhileReading) {}

}  // namespace
}  // namespace blink