xref: /aosp_15_r20/external/cronet/net/data/cache_tests/good_2_1/contents.txt (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1This is a sample valid cache in 2.1 format.
2This was produced before the 3.0 format change by the following test:
3
4TEST_F(DiskCacheBackendTest, CreateCorrect21) {
5  const char* kKey = "https://example.org/data";
6  cache_path_ = base::FilePath("/tmp/cache-correct-2.1");
7  CleanupCacheDir();
8  CHECK(base::CreateDirectory(cache_path_));
9
10  SetMaxSize(16*1024);
11  SetNewEviction();
12  InitCache();
13
14  disk_cache::Entry* entry = nullptr;
15  ASSERT_THAT(CreateEntry(kKey, &entry), IsOk());
16
17  const int kBufSize = 1234;
18  scoped_refptr<net::IOBuffer> buffer =
19      base::MakeRefCounted<net::IOBufferWithSize>(kBufSize);
20  CacheTestFillBuffer(buffer->data(), kBufSize, /*no_nulls=*/false);
21
22  EXPECT_EQ(kBufSize, WriteData(entry, /*index=*/1, /*offset=*/0, buffer.get(),
23                                /*len=*/kBufSize, /*truncate=*/false));
24  entry->Close();
25}
26
27With the following patch applied:
28--- a/net/disk_cache/blockfile/block_files.cc
29+++ b/net/disk_cache/blockfile/block_files.cc
30@@ -487,7 +487,7 @@ bool BlockFiles::GrowBlockFile(MappedFile* file, BlockFileHeader* header) {
31
32   ScopedFlush flush(file);
33   DCHECK(!header->empty[3]);
34-  int new_size = header->max_entries + 1024;
35+  int new_size = header->max_entries + 64;
36   if (new_size > kMaxBlocks)
37     new_size = kMaxBlocks;
38
39To keep the data_ file size down somewhat.
40