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

Unified Diff: net/disk_cache/block_files_unittest.cc

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl 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/disk_cache_perftest.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 232523)
+++ net/disk_cache/block_files_unittest.cc (working copy)
@@ -34,7 +34,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];
@@ -60,7 +60,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];
@@ -83,7 +83,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];
@@ -136,7 +136,7 @@
files.CloseFiles();
- ASSERT_TRUE(files.Init(false));
+ ASSERT_TRUE(files.Init(false, kFirstAdditionalBlockFile));
// The file must have been fixed.
file = files.GetFile(address);
@@ -160,9 +160,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.
{
@@ -172,7 +172,7 @@
}
// Initializing should fail, not crash.
- ASSERT_FALSE(files.Init(false));
+ ASSERT_FALSE(files.Init(false, kFirstAdditionalBlockFile));
}
// Handling of truncated files (non empty).
@@ -181,11 +181,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.
{
@@ -195,7 +195,7 @@
}
// Initializing should fail, not crash.
- ASSERT_FALSE(files.Init(false));
+ ASSERT_FALSE(files.Init(false, kFirstAdditionalBlockFile));
}
// Tests detection of out of sync counters.
@@ -204,7 +204,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);
@@ -221,7 +221,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());
@@ -235,7 +235,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());
@@ -250,7 +250,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.
@@ -259,14 +259,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,
@@ -283,7 +283,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);
@@ -305,7 +305,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/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698