Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: net/disk_cache/block_files_unittest.cc

Issue 15203004: Disk cache: Reference CL for the implementation of file format version 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: IndexTable review Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/block_files.cc ('k') | net/disk_cache/cache_creator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/block_files_unittest.cc
===================================================================
--- net/disk_cache/block_files_unittest.cc (revision 199883)
+++ net/disk_cache/block_files_unittest.cc (working copy)
@@ -33,7 +33,7 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
const int kMaxSize = 35000;
Addr address[kMaxSize];
@@ -59,7 +59,7 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
const int kMaxSize = 35000;
Addr address[kMaxSize];
@@ -82,7 +82,7 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
const int kNumEntries = 2000;
CacheAddr entries[kNumEntries];
@@ -135,7 +135,7 @@
files.CloseFiles();
- ASSERT_TRUE(files.Init(false));
+ ASSERT_TRUE(files.Init(false, kFirstAdditionalBlockFile));
// The file must have been fixed.
file = files.GetFile(address);
@@ -159,9 +159,9 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
- base::FilePath filename = files.Name(0);
+ base::FilePath filename = files.HeaderName(0);
files.CloseFiles();
// Truncate one of the files.
{
@@ -171,7 +171,7 @@
}
// Initializing should fail, not crash.
- ASSERT_FALSE(files.Init(false));
+ ASSERT_FALSE(files.Init(false, kFirstAdditionalBlockFile));
}
// Handling of truncated files (non empty).
@@ -180,11 +180,11 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
Addr address;
EXPECT_TRUE(files.CreateBlock(RANKINGS, 2, &address));
- base::FilePath filename = files.Name(0);
+ base::FilePath filename = files.HeaderName(0);
files.CloseFiles();
// Truncate one of the files.
{
@@ -194,7 +194,7 @@
}
// Initializing should fail, not crash.
- ASSERT_FALSE(files.Init(false));
+ ASSERT_FALSE(files.Init(false, kFirstAdditionalBlockFile));
}
// Tests detection of out of sync counters.
@@ -203,7 +203,7 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
// Create a block of size 2.
Addr address(0);
@@ -220,7 +220,7 @@
header->empty[2] = 50; // 50 free blocks of size 3.
files.CloseFiles();
- ASSERT_TRUE(files.Init(false));
+ ASSERT_TRUE(files.Init(false, kFirstAdditionalBlockFile));
file = files.GetFile(address);
ASSERT_TRUE(NULL != file);
header = reinterpret_cast<BlockFileHeader*>(file->buffer());
@@ -234,7 +234,7 @@
header->updating = 1;
files.CloseFiles();
- ASSERT_TRUE(files.Init(false));
+ ASSERT_TRUE(files.Init(false, kFirstAdditionalBlockFile));
file = files.GetFile(address);
ASSERT_TRUE(NULL != file);
header = reinterpret_cast<BlockFileHeader*>(file->buffer());
@@ -249,7 +249,7 @@
files.CloseFiles();
// Detect the error.
- ASSERT_FALSE(files.Init(false));
+ ASSERT_FALSE(files.Init(false, kFirstAdditionalBlockFile));
}
// An invalid file can be detected after init.
@@ -258,14 +258,14 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
// Let's access block 10 of file 5. (There is no file).
Addr addr(BLOCK_256, 1, 5, 10);
EXPECT_TRUE(NULL == files.GetFile(addr));
// Let's create an invalid file.
- base::FilePath filename(files.Name(5));
+ base::FilePath filename(files.HeaderName(5));
char header[kBlockHeaderSize];
memset(header, 'a', kBlockHeaderSize);
EXPECT_EQ(kBlockHeaderSize,
@@ -282,7 +282,7 @@
ASSERT_TRUE(CopyTestCache("remove_load1"));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(false));
+ ASSERT_TRUE(files.Init(false, kFirstAdditionalBlockFile));
int used, load;
files.GetFileStats(0, &used, &load);
@@ -304,7 +304,7 @@
ASSERT_TRUE(file_util::CreateDirectory(cache_path_));
BlockFiles files(cache_path_);
- ASSERT_TRUE(files.Init(true));
+ ASSERT_TRUE(files.Init(true, kFirstAdditionalBlockFile));
// Create a bunch of entries.
const int kSize = 100;
« no previous file with comments | « net/disk_cache/block_files.cc ('k') | net/disk_cache/cache_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698