chromium/storage/browser/blob/blob_storage_context_unittest.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 "storage/browser/blob/blob_storage_context.h"

#include <stdint.h>

#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <utility>

#include "base/files/file.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/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "base/test/test_simple_task_runner.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "net/base/io_buffer.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_data_item.h"
#include "storage/browser/blob/blob_data_snapshot.h"
#include "storage/browser/blob/blob_impl.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/fake_blob_data_handle.h"
#include "storage/browser/test/test_file_system_context.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace storage {
namespace {

FileCreationInfo;
TestSimpleTaskRunner;

const size_t kTestBlobStorageIPCThresholdBytes =;
const size_t kTestBlobStorageMaxSharedMemoryBytes =;

const size_t kTestBlobStorageMaxBlobMemorySize =;
const uint64_t kTestBlobStorageMaxDiskSpace =;
const uint64_t kTestBlobStorageMinFileSizeBytes =;
const uint64_t kTestBlobStorageMaxFileSizeBytes =;

void SaveBlobStatus(BlobStatus* status_ptr, BlobStatus status) {}

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

void IncrementNumber(size_t* number, BlobStatus status) {}

}  // namespace

class BlobStorageContextTest : public testing::Test {};

TEST_F(BlobStorageContextTest, BuildBlobAsync) {}

TEST_F(BlobStorageContextTest, BuildBlobAndCancel) {}

TEST_F(BlobStorageContextTest, CancelledReference) {}

TEST_F(BlobStorageContextTest, IncorrectSlice) {}

TEST_F(BlobStorageContextTest, IncrementDecrementRef) {}

TEST_F(BlobStorageContextTest, BlobDataHandle) {}

TEST_F(BlobStorageContextTest, MemoryUsage) {}

TEST_F(BlobStorageContextTest, AddFinishedBlob) {}

TEST_F(BlobStorageContextTest, AddFinishedBlob_LargeOffset) {}

TEST_F(BlobStorageContextTest, BuildReadableDataHandleBlob) {}

TEST_F(BlobStorageContextTest, BuildFutureFileOnlyBlob) {}

TEST_F(BlobStorageContextTest, CompoundBlobs) {}

TEST_F(BlobStorageContextTest, TestUnknownBrokenAndBuildingBlobReference) {}

namespace {
constexpr size_t kTotalRawBlobs =;
constexpr size_t kTotalSlicedBlobs =;
constexpr char kTestDataHandleData[] =;

// Appends data and data types that depend on the index. This is designed to
// exercise all types of combinations of data, future data, files, future files,
// and disk cache entries.
size_t AppendDataInBuilder(
    BlobDataBuilder* builder,
    std::vector<BlobDataBuilder::FutureData>* future_datas,
    std::vector<BlobDataBuilder::FutureFile>* future_files,
    size_t index,
    scoped_refptr<BlobDataItem::DataHandle> data_handle) {}

bool DoesBuilderHaveFutureData(size_t index) {}

void PopulateDataInBuilder(
    std::vector<BlobDataBuilder::FutureData>* future_datas,
    std::vector<BlobDataBuilder::FutureFile>* future_files,
    size_t index,
    base::TaskRunner* file_runner) {}
}  // namespace

TEST_F(BlobStorageContextTest, BuildBlobCombinations) {}

TEST_F(BlobStorageContextTest, NegativeSlice) {}

// TODO(michaeln): tests for the deprecated url stuff

}  // namespace storage