#ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_
#define NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_
#include <stddef.h>
#include <array>
#include <string>
#include "base/functional/callback.h"
namespace base {
class FilePath;
}
namespace disk_cache::simple_util {
template <typename T, size_t Size>
class ImmutableArray {
public:
static const size_t size = Size;
explicit ImmutableArray(
const base::RepeatingCallback<T(size_t index)>& initializer) {
for (size_t i = 0; i < size; ++i)
data_[i] = initializer.Run(i);
}
template <size_t Index>
const T& at() const {
static_assert(Index < size, "array out of bounds");
return data_[Index];
}
private:
std::array<T, size> data_;
};
bool CreateCorruptFileForTests(const std::string& key,
const base::FilePath& cache_path);
bool RemoveKeySHA256FromEntry(const std::string& key,
const base::FilePath& cache_path);
bool CorruptKeySHA256FromEntry(const std::string& key,
const base::FilePath& cache_path);
bool CorruptStream0LengthFromEntry(const std::string& key,
const base::FilePath& cache_path);
}
#endif