#include "storage/browser/blob/blob_registry_impl.h"
#include <limits>
#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "base/feature_list.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/rand_util.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_restrictions.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/system/data_pipe_utils.h"
#include "mojo/public/cpp/system/functions.h"
#include "net/base/features.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/blob/blob_url_registry.h"
#include "storage/browser/file_system/external_mount_points.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/fake_blob.h"
#include "storage/browser/test/fake_progress_client.h"
#include "storage/browser/test/mock_blob_registry_delegate.h"
#include "storage/browser/test/mock_bytes_provider.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/blob/data_element.mojom.h"
#include "third_party/blink/public/mojom/blob/serialized_blob.mojom.h"
namespace storage {
namespace {
const size_t kTestBlobStorageIPCThresholdBytes = …;
const size_t kTestBlobStorageMaxSharedMemoryBytes = …;
const size_t kTestBlobStorageMaxBytesDataItemSize = …;
const size_t kTestBlobStorageMaxBlobMemorySize = …;
const uint64_t kTestBlobStorageMaxDiskSpace = …;
const uint64_t kTestBlobStorageMinFileSizeBytes = …;
const uint64_t kTestBlobStorageMaxFileSizeBytes = …;
void BindBytesProvider(
std::unique_ptr<MockBytesProvider> impl,
mojo::PendingReceiver<blink::mojom::BytesProvider> receiver) { … }
}
class BlobRegistryImplTest : public testing::Test { … };
TEST_F(BlobRegistryImplTest, GetBlobFromUUID) { … }
TEST_F(BlobRegistryImplTest, GetBlobFromEmptyUUID) { … }
TEST_F(BlobRegistryImplTest, Register_EmptyUUID) { … }
TEST_F(BlobRegistryImplTest, Register_ExistingUUID) { … }
TEST_F(BlobRegistryImplTest, Register_EmptyBlob) { … }
TEST_F(BlobRegistryImplTest, Register_EmptyBytesBlob) { … }
TEST_F(BlobRegistryImplTest, Register_ReferencedBlobClosedPipe) { … }
TEST_F(BlobRegistryImplTest, Register_SelfReference) { … }
TEST_F(BlobRegistryImplTest, Register_CircularReference) { … }
TEST_F(BlobRegistryImplTest, Register_NonExistentBlob) { … }
TEST_F(BlobRegistryImplTest, Register_ValidBlobReferences) { … }
TEST_F(BlobRegistryImplTest, Register_BlobReferencingPendingBlob) { … }
TEST_F(BlobRegistryImplTest, Register_UnreadableFile) { … }
TEST_F(BlobRegistryImplTest, Register_ValidFile) { … }
TEST_F(BlobRegistryImplTest, Register_BytesInvalidEmbeddedData) { … }
TEST_F(BlobRegistryImplTest, Register_BytesInvalidDataSize) { … }
TEST_F(BlobRegistryImplTest, Register_BytesOutOfMemory) { … }
TEST_F(BlobRegistryImplTest, Register_ValidEmbeddedBytes) { … }
TEST_F(BlobRegistryImplTest, Register_ValidBytesAsReply) { … }
TEST_F(BlobRegistryImplTest, Register_InvalidBytesAsReply) { … }
TEST_F(BlobRegistryImplTest, Register_ValidBytesAsStream) { … }
TEST_F(BlobRegistryImplTest, Register_ValidBytesAsFile) { … }
TEST_F(BlobRegistryImplTest, Register_BytesProviderClosedPipe) { … }
TEST_F(BlobRegistryImplTest,
Register_DefereferencedWhileBuildingBeforeBreaking) { … }
TEST_F(BlobRegistryImplTest,
Register_DefereferencedWhileBuildingBeforeResolvingDeps) { … }
TEST_F(BlobRegistryImplTest,
Register_DefereferencedWhileBuildingBeforeTransporting) { … }
TEST_F(BlobRegistryImplTest,
Register_DefereferencedWhileBuildingBeforeTransportingByFile) { … }
TEST_F(BlobRegistryImplTest, RegisterFromStream) { … }
TEST_F(BlobRegistryImplTest, RegisterFromStream_NoDiskSpace) { … }
TEST_F(BlobRegistryImplTest, DestroyWithUnfinishedStream) { … }
}