chromium/net/base/elements_upload_data_stream_unittest.cc

// Copyright 2012 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/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/base/elements_upload_data_stream.h"

#include <stdint.h>

#include <algorithm>
#include <limits>
#include <string_view>
#include <vector>

#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/base/upload_bytes_element_reader.h"
#include "net/base/upload_data_stream.h"
#include "net/base/upload_file_element_reader.h"
#include "net/log/net_log_with_source.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"

IsError;
IsOk;

DoAll;
Invoke;
Return;
_;

namespace net {

namespace {

const char kTestData[] =;
const size_t kTestDataSize =;
const size_t kTestBufferSize =;  // 16KB.

// Reads data from the upload data stream, and returns the data as string.
std::string ReadFromUploadDataStream(UploadDataStream* stream) {}

// A mock class of UploadElementReader.
class MockUploadElementReader : public UploadElementReader {};

}  // namespace

class ElementsUploadDataStreamTest : public PlatformTest,
                                     public WithTaskEnvironment {};

TEST_F(ElementsUploadDataStreamTest, EmptyUploadData) {}

TEST_F(ElementsUploadDataStreamTest, ConsumeAllBytes) {}

TEST_F(ElementsUploadDataStreamTest, File) {}

TEST_F(ElementsUploadDataStreamTest, FileSmallerThanLength) {}

TEST_F(ElementsUploadDataStreamTest, ReadErrorSync) {}

TEST_F(ElementsUploadDataStreamTest, ReadErrorAsync) {}

TEST_F(ElementsUploadDataStreamTest, FileAndBytes) {}

// Init() with on-memory and not-on-memory readers.
TEST_F(ElementsUploadDataStreamTest, InitAsync) {}

// Init() of a reader fails asynchronously.
TEST_F(ElementsUploadDataStreamTest, InitAsyncFailureAsync) {}

// Init() of a reader fails synchronously.
TEST_F(ElementsUploadDataStreamTest, InitAsyncFailureSync) {}

// Read with a buffer whose size is same as the data.
TEST_F(ElementsUploadDataStreamTest, ReadAsyncWithExactSizeBuffer) {}

// Async Read() with on-memory and not-on-memory readers.
TEST_F(ElementsUploadDataStreamTest, ReadAsync) {}

void ElementsUploadDataStreamTest::FileChangedHelper(
    const base::FilePath& file_path,
    const base::Time& time,
    bool error_expected) {}

TEST_F(ElementsUploadDataStreamTest, FileChanged) {}

TEST_F(ElementsUploadDataStreamTest, MultipleInit) {}

TEST_F(ElementsUploadDataStreamTest, MultipleInitAsync) {}

TEST_F(ElementsUploadDataStreamTest, InitToReset) {}

TEST_F(ElementsUploadDataStreamTest, InitDuringAsyncInit) {}

TEST_F(ElementsUploadDataStreamTest, InitDuringAsyncRead) {}

}  // namespace net