#include "storage/browser/blob/blob_transport_strategy.h"
#include <algorithm>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#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/rand_util.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "mojo/public/cpp/system/functions.h"
#include "storage/browser/blob/blob_data_builder.h"
#include "storage/browser/test/mock_bytes_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/blob/data_element.mojom.h"
namespace storage {
namespace {
MemoryStrategy;
FileInfoVector;
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 = …;
const char kId[] = …;
void BindBytesProvider(
std::unique_ptr<MockBytesProvider> impl,
mojo::PendingReceiver<blink::mojom::BytesProvider> receiver) { … }
class BlobTransportStrategyTest : public testing::Test { … };
class BasicTests : public BlobTransportStrategyTest,
public testing::WithParamInterface<MemoryStrategy> { … };
TEST_P(BasicTests, NoBytes) { … }
TEST_P(BasicTests, WithBytes) { … }
INSTANTIATE_TEST_SUITE_P(…);
class BasicErrorTests : public BlobTransportStrategyTest,
public testing::WithParamInterface<MemoryStrategy> { … };
TEST_P(BasicErrorTests, NotEnoughBytesInProvider) { … }
TEST_P(BasicErrorTests, TooManyBytesInProvider) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(BlobTransportStrategyTest, DataStreamChunksData) { … }
TEST_F(BlobTransportStrategyTest, Files_NoBytes) { … }
TEST_F(BlobTransportStrategyTest, Files_WriteFailed) { … }
TEST_F(BlobTransportStrategyTest, Files_ValidBytesOneElement) { … }
TEST_F(BlobTransportStrategyTest, Files_ValidBytesMultipleElements) { … }
}
}