#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "storage/browser/blob/blob_memory_controller.h"
#include <optional>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/system/sys_info.h"
#include "base/test/task_environment.h"
#include "base/test/test_simple_task_runner.h"
#include "base/threading/thread_restrictions.h"
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/blob/blob_data_item.h"
#include "storage/browser/blob/shareable_blob_data_item.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace storage {
Strategy;
FileCreationInfo;
TestSimpleTaskRunner;
ItemState;
QuotaAllocationTask;
const size_t kTestBlobStorageIPCThresholdBytes = …;
const size_t kTestBlobStorageMaxSharedMemoryBytes = …;
const size_t kTestBlobStorageMaxBlobMemorySize = …;
const float kTestMaxBlobInMemorySpaceUnderPressureRatio = …;
const uint64_t kTestBlobStorageMaxDiskSpace = …;
const uint64_t kTestBlobStorageMinFileSizeBytes = …;
const uint64_t kTestBlobStorageMaxFileSizeBytes = …;
const uint64_t kTestSmallBlobStorageMaxDiskSpace = …;
static int64_t sFakeDiskSpace = …;
static bool sFakeDiskSpaceCalled = …;
int64_t FakeDiskSpaceMethod(const base::FilePath& path) { … }
class BlobMemoryControllerTest : public testing::Test { … };
TEST_F(BlobMemoryControllerTest, Strategy) { … }
TEST_F(BlobMemoryControllerTest, GrantMemory) { … }
TEST_F(BlobMemoryControllerTest, SimpleMemoryRequest) { … }
TEST_F(BlobMemoryControllerTest, PageToDisk) { … }
TEST_F(BlobMemoryControllerTest, NoDiskTooLarge) { … }
TEST_F(BlobMemoryControllerTest, TooLargeForDisk) { … }
TEST_F(BlobMemoryControllerTest, CancelMemoryRequest) { … }
TEST_F(BlobMemoryControllerTest, FileRequest) { … }
TEST_F(BlobMemoryControllerTest, CancelFileRequest) { … }
TEST_F(BlobMemoryControllerTest, MultipleFilesPaged) { … }
TEST_F(BlobMemoryControllerTest, FullEviction) { … }
TEST_F(BlobMemoryControllerTest, PagingStopsWhenFull) { … }
TEST_F(BlobMemoryControllerTest, DisableDiskWithFileAndMemoryPending) { … }
TEST_F(BlobMemoryControllerTest, DiskSpaceTooSmallForItem) { … }
TEST_F(BlobMemoryControllerTest, DiskSpaceHitMinAvailable) { … }
TEST_F(BlobMemoryControllerTest, DiskSpaceBeforeMinAvailable) { … }
TEST_F(BlobMemoryControllerTest, DiskSpaceNearMinAvailable) { … }
TEST_F(BlobMemoryControllerTest, DiskSpaceResetAfterIncrease) { … }
TEST_F(BlobMemoryControllerTest, DiskSpaceUnknown) { … }
TEST_F(BlobMemoryControllerTest, OnMemoryPressure) { … }
TEST_F(BlobMemoryControllerTest, LowMemoryDevice) { … }
}