blob: b5b2295c953c59adf613c63fd575c81faeb9fff0 [file] [log] [blame]
This is a sample valid cache in 2.1 format.
This was produced before the 3.0 format change by the following test:
TEST_F(DiskCacheBackendTest, CreateCorrect21) {
const char* kKey = "https://example.org/data";
cache_path_ = base::FilePath("/tmp/cache-correct-2.1");
CleanupCacheDir();
CHECK(base::CreateDirectory(cache_path_));
SetMaxSize(16*1024);
SetNewEviction();
InitCache();
disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(kKey, &entry), IsOk());
const int kBufSize = 1234;
scoped_refptr<net::IOBuffer> buffer =
base::MakeRefCounted<net::IOBufferWithSize>(kBufSize);
CacheTestFillBuffer(buffer->data(), kBufSize, /*no_nulls=*/false);
EXPECT_EQ(kBufSize, WriteData(entry, /*index=*/1, /*offset=*/0, buffer.get(),
/*len=*/kBufSize, /*truncate=*/false));
entry->Close();
}
With the following patch applied:
--- a/net/disk_cache/blockfile/block_files.cc
+++ b/net/disk_cache/blockfile/block_files.cc
@@ -487,7 +487,7 @@ bool BlockFiles::GrowBlockFile(MappedFile* file, BlockFileHeader* header) {
ScopedFlush flush(file);
DCHECK(!header->empty[3]);
- int new_size = header->max_entries + 1024;
+ int new_size = header->max_entries + 64;
if (new_size > kMaxBlocks)
new_size = kMaxBlocks;
To keep the data_ file size down somewhat.