chromium/storage/browser/blob/blob_reader_unittest.cc

// Copyright 2015 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 "storage/browser/blob/blob_reader.h"

#include <stddef.h>
#include <stdint.h>
#include <string.h>

#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/containers/heap_array.h"
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_runner.h"
#include "base/test/bind.h"
#include "base/test/task_environment.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 "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "storage/browser/file_system/file_stream_reader.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_file_util.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/async_file_test_helper.h"
#include "storage/browser/test/fake_blob_data_handle.h"
#include "storage/browser/test/test_file_system_context.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

FilePath;
DrainableIOBuffer;
IOBuffer;

namespace storage {
namespace {

FileCreationInfo;

void SaveBlobStatusAndFiles(BlobStatus* status_ptr,
                            std::vector<FileCreationInfo>* files_ptr,
                            BlobStatus status,
                            std::vector<FileCreationInfo> files) {}

template <typename T>
void SetValue(T* address, T value) {}

class FakeFileStreamReader : public FileStreamReader {};

class MockFileStreamReaderProvider
    : public BlobReader::FileStreamReaderProvider {};

}  // namespace

class BlobReaderTest : public ::testing::Test {};

TEST_F(BlobReaderTest, BasicMemory) {}

TEST_F(BlobReaderTest, BasicFile) {}

TEST_F(BlobReaderTest, BasicFileSystem) {}

TEST_F(BlobReaderTest, BasicReadableDataHandle) {}

TEST_F(BlobReaderTest, ReadableDataHandleWithSideData) {}

TEST_F(BlobReaderTest, BufferLargerThanMemory) {}

TEST_F(BlobReaderTest, MemoryRange) {}

TEST_F(BlobReaderTest, BufferSmallerThanMemory) {}

TEST_F(BlobReaderTest, SegmentedBufferAndMemory) {}

TEST_F(BlobReaderTest, FileAsync) {}

TEST_F(BlobReaderTest, FileSystemAsync) {}

TEST_F(BlobReaderTest, ReadableDataHandleSingle) {}

// This test is the same as ReadableDataHandleSingle, but adds the
// additional wrinkle of a SetReadRange call.
TEST_F(BlobReaderTest, ReadableDataHandleSingleRange) {}

TEST_F(BlobReaderTest, ReadableDataHandleMultipleSlices) {}

TEST_F(BlobReaderTest, FileRange) {}

TEST_F(BlobReaderTest, ReadableDataHandleRange) {}

TEST_F(BlobReaderTest, FileSomeAsyncSegmentedOffsetsUnknownSizes) {}

TEST_F(BlobReaderTest, MixedContent) {}

TEST_F(BlobReaderTest, StateErrors) {}

TEST_F(BlobReaderTest, FileErrorsSync) {}

TEST_F(BlobReaderTest, FileErrorsAsync) {}

TEST_F(BlobReaderTest, RangeError) {}

TEST_F(BlobReaderTest, HandleBeforeAsyncCancel) {}

TEST_F(BlobReaderTest, ReadFromIncompleteBlob) {}

}  // namespace storage