#include "services/network/shared_dictionary/shared_dictionary_writer_on_disk.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/test_file_util.h"
#include "build/build_config.h"
#include "crypto/secure_hash.h"
#include "net/base/hash_value.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/disk_cache_test_util.h"
#include "net/disk_cache/mock/mock_backend_impl.h"
#include "net/disk_cache/mock/mock_entry_impl.h"
#include "services/network/shared_dictionary/shared_dictionary_constants.h"
#include "services/network/shared_dictionary/shared_dictionary_disk_cache.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace network {
namespace {
const std::string kTestData = …;
const std::string kTestData1 = …;
const std::string kTestData2 = …;
enum class CreateBackendResultType { … };
net::SHA256HashValue GetHash(const std::string& data) { … }
class FakeSharedDictionaryDiskCache : public SharedDictionaryDiskCache { … };
class SharedDictionaryWriterOnDiskTest : public testing::Test { … };
void SharedDictionaryWriterOnDiskTest::RunSimpleWriteTest(
bool sync_create_backend,
bool sync_create_entry,
bool sync_write_data) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, SimpleWrite) { … }
void SharedDictionaryWriterOnDiskTest::RunCreateBackendFailureTest(
bool sync_create_backend) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, CreateBackendFailure) { … }
void SharedDictionaryWriterOnDiskTest::RunCreateEntryFailureTest(
bool sync_create_backend,
bool sync_create_entry) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, CreateEntryFailure) { … }
void SharedDictionaryWriterOnDiskTest::RunWriteDataFailureTest(
bool sync_create_backend,
bool sync_create_entry,
bool sync_write_data) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, WriteDataFailure) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, MultipleWrite) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, MultipleWriteSyncWrite) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, AsyncWriteFailureOnMultipleWrites) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, SyncWriteFailureOnMultipleWrites) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, AbortedWithoutWrite) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, AbortedAfterWrite) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, ErrorSizeZero) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, ErrorSizeExceedsLimitBeforeOnEntry) { … }
TEST_F(SharedDictionaryWriterOnDiskTest, ErrorSizeExceedsLimitAfterOnEntry) { … }
}
}