Index: net/disk_cache/backend_unittest.cc |
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc |
index e118dc6a9bd6e1c2e1fdd91df3aedfc3e78b3dab..33f87ac3d0ab57265dba463e37869bffbd2484bf 100644 |
--- a/net/disk_cache/backend_unittest.cc |
+++ b/net/disk_cache/backend_unittest.cc |
@@ -277,7 +277,7 @@ bool DiskCacheBackendTest::EnumerateAndMatchKeys( |
void DiskCacheBackendTest::BackendBasics() { |
InitCache(); |
- disk_cache::Entry *entry1 = NULL, *entry2 = NULL; |
+ disk_cache::Entry* entry1 = NULL, *entry2 = NULL; |
EXPECT_NE(net::OK, OpenEntry("the first key", &entry1)); |
ASSERT_EQ(net::OK, CreateEntry("the first key", &entry1)); |
ASSERT_TRUE(NULL != entry1); |
@@ -349,7 +349,7 @@ void DiskCacheBackendTest::BackendKeying() { |
InitCache(); |
const char* kName1 = "the first key"; |
const char* kName2 = "the first Key"; |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
ASSERT_EQ(net::OK, CreateEntry(kName1, &entry1)); |
ASSERT_EQ(net::OK, CreateEntry(kName2, &entry2)); |
@@ -367,7 +367,7 @@ void DiskCacheBackendTest::BackendKeying() { |
EXPECT_TRUE(entry1 == entry2); |
entry2->Close(); |
- base::strlcpy(buffer + 3, kName1, arraysize(buffer) - 3); |
+ base::strlcpy(buffer + 3, kName1, arraysize(buffer) - 3); |
ASSERT_EQ(net::OK, OpenEntry(buffer + 3, &entry2)); |
EXPECT_TRUE(entry1 == entry2); |
entry2->Close(); |
@@ -442,8 +442,12 @@ TEST_F(DiskCacheTest, CreateBackend) { |
rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE, |
net::CACHE_BACKEND_DEFAULT, |
- base::FilePath(), 0, |
- false, NULL, NULL, &cache, |
+ base::FilePath(), |
+ 0, |
+ false, |
+ NULL, |
+ NULL, |
+ &cache, |
cb.callback()); |
ASSERT_EQ(net::OK, cb.GetResult(rv)); |
ASSERT_TRUE(cache.get()); |
@@ -558,10 +562,16 @@ TEST_F(DiskCacheBackendTest, MultipleInstancesWithPendingFileIO) { |
net::TestCompletionCallback cb; |
scoped_ptr<disk_cache::Backend> extra_cache; |
- int rv = disk_cache::CreateCacheBackend( |
- net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, store.path(), 0, |
- false, base::MessageLoopProxy::current().get(), NULL, |
- &extra_cache, cb.callback()); |
+ int rv = |
+ disk_cache::CreateCacheBackend(net::DISK_CACHE, |
+ net::CACHE_BACKEND_DEFAULT, |
+ store.path(), |
+ 0, |
+ false, |
+ base::MessageLoopProxy::current().get(), |
+ NULL, |
+ &extra_cache, |
+ cb.callback()); |
ASSERT_EQ(net::OK, cb.GetResult(rv)); |
ASSERT_TRUE(extra_cache.get() != NULL); |
@@ -640,7 +650,7 @@ void DiskCacheBackendTest::BackendShutdownWithPendingCreate(bool fast) { |
base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); |
disk_cache::BackendFlags flags = |
- fast ? disk_cache::kNone : disk_cache::kNoRandom; |
+ fast ? disk_cache::kNone : disk_cache::kNoRandom; |
CreateBackend(flags, &cache_thread); |
disk_cache::Entry* entry; |
@@ -840,7 +850,7 @@ TEST_F(DiskCacheBackendTest, ShaderCacheLoad) { |
// Tests the chaining of an entry to the current head. |
void DiskCacheBackendTest::BackendChain() { |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
InitCache(); |
@@ -1297,7 +1307,7 @@ void DiskCacheBackendTest::BackendEnumerations2() { |
InitCache(); |
const std::string first("first"); |
const std::string second("second"); |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
ASSERT_EQ(net::OK, CreateEntry(first, &entry1)); |
entry1->Close(); |
ASSERT_EQ(net::OK, CreateEntry(second, &entry2)); |
@@ -1368,7 +1378,7 @@ TEST_F(DiskCacheBackendTest, ShaderCacheEnumerationReadData) { |
InitCache(); |
const std::string first("first"); |
const std::string second("second"); |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
const int kSize = 50; |
scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); |
@@ -1403,7 +1413,7 @@ void DiskCacheBackendTest::BackendInvalidEntryEnumeration() { |
InitCache(); |
std::string key("Some key"); |
- disk_cache::Entry *entry, *entry1, *entry2; |
+ disk_cache::Entry* entry, *entry1, *entry2; |
ASSERT_EQ(net::OK, CreateEntry(key, &entry1)); |
const int kSize = 50; |
@@ -1463,7 +1473,7 @@ void DiskCacheBackendTest::BackendFixEnumerators() { |
} |
EXPECT_EQ(kNumEntries, cache_->GetEntryCount()); |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
void* iter1 = NULL; |
void* iter2 = NULL; |
ASSERT_EQ(net::OK, OpenNextEntry(&iter1, &entry1)); |
@@ -1514,7 +1524,7 @@ TEST_F(DiskCacheBackendTest, NewEvictionFixEnumerators) { |
void DiskCacheBackendTest::BackendDoomRecent() { |
InitCache(); |
- disk_cache::Entry *entry; |
+ disk_cache::Entry* entry; |
ASSERT_EQ(net::OK, CreateEntry("first", &entry)); |
entry->Close(); |
ASSERT_EQ(net::OK, CreateEntry("second", &entry)); |
@@ -1592,7 +1602,7 @@ TEST_F(DiskCacheBackendTest, DoomAllSparse) { |
void DiskCacheBackendTest::BackendDoomBetween() { |
InitCache(); |
- disk_cache::Entry *entry; |
+ disk_cache::Entry* entry; |
ASSERT_EQ(net::OK, CreateEntry("first", &entry)); |
entry->Close(); |
FlushQueueForTest(); |
@@ -1673,7 +1683,8 @@ TEST_F(DiskCacheBackendTest, DoomEntriesBetweenSparse) { |
} |
void DiskCacheBackendTest::BackendTransaction(const std::string& name, |
- int num_entries, bool load) { |
+ int num_entries, |
+ bool load) { |
success_ = false; |
ASSERT_TRUE(CopyTestCache(name)); |
DisableFirstCleanup(); |
@@ -1847,7 +1858,7 @@ class BadEntropyProvider : public base::FieldTrial::EntropyProvider { |
TEST_F(DiskCacheTest, SimpleCacheControlJoin) { |
base::Thread cache_thread("CacheThread"); |
ASSERT_TRUE(cache_thread.StartWithOptions( |
- base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); |
+ base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); |
scoped_ptr<disk_cache::BackendImpl> cache = |
CreateExistingEntryCache(cache_thread, cache_path_); |
@@ -1887,7 +1898,7 @@ TEST_F(DiskCacheTest, SimpleCacheControlRestart) { |
base::Thread cache_thread("CacheThread"); |
ASSERT_TRUE(cache_thread.StartWithOptions( |
- base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); |
+ base::Thread::Options(base::MessageLoop::TYPE_IO, 0))); |
scoped_ptr<disk_cache::BackendImpl> cache = |
CreateExistingEntryCache(cache_thread, cache_path_); |
@@ -1990,7 +2001,7 @@ void DiskCacheBackendTest::BackendInvalidEntry2() { |
DisableFirstCleanup(); |
InitCache(); |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
ASSERT_EQ(net::OK, OpenEntry("the first key", &entry1)); |
EXPECT_NE(net::OK, OpenEntry("some other key", &entry2)); |
entry1->Close(); |
@@ -2010,7 +2021,7 @@ TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry2) { |
// Tests that we don't crash or hang when enumerating this cache. |
void DiskCacheBackendTest::BackendInvalidEntry3() { |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
DisableFirstCleanup(); |
InitCache(); |
@@ -2038,7 +2049,7 @@ TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry3) { |
// the same key, and with hash collisions. |
TEST_F(DiskCacheBackendTest, InvalidEntry4) { |
ASSERT_TRUE(CopyTestCache("dirty_entry3")); |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
DisableFirstCleanup(); |
InitCache(); |
@@ -2051,7 +2062,7 @@ TEST_F(DiskCacheBackendTest, InvalidEntry4) { |
TEST_F(DiskCacheBackendTest, InvalidEntry5) { |
ASSERT_TRUE(CopyTestCache("dirty_entry4")); |
SetNewEviction(); |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
DisableFirstCleanup(); |
InitCache(); |
@@ -2061,7 +2072,7 @@ TEST_F(DiskCacheBackendTest, InvalidEntry5) { |
TEST_F(DiskCacheBackendTest, InvalidEntry6) { |
ASSERT_TRUE(CopyTestCache("dirty_entry5")); |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
DisableFirstCleanup(); |
InitCache(); |
@@ -2078,7 +2089,7 @@ TEST_F(DiskCacheBackendTest, InvalidEntry6) { |
// The test cache could be a result of bug 69135. |
TEST_F(DiskCacheBackendTest, BadNextEntry1) { |
ASSERT_TRUE(CopyTestCache("list_loop2")); |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
DisableFirstCleanup(); |
InitCache(); |
@@ -2101,7 +2112,7 @@ TEST_F(DiskCacheBackendTest, BadNextEntry1) { |
// The test cache could be a result of bug 69135. |
TEST_F(DiskCacheBackendTest, BadNextEntry2) { |
ASSERT_TRUE(CopyTestCache("list_loop3")); |
- SetMask(0x1); // 2-entry table. |
+ SetMask(0x1); // 2-entry table. |
SetMaxSize(0x3000); // 12 kB. |
DisableFirstCleanup(); |
InitCache(); |
@@ -2466,7 +2477,7 @@ void DiskCacheBackendTest::BackendInvalidRankings2() { |
DisableFirstCleanup(); |
InitCache(); |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
EXPECT_NE(net::OK, OpenEntry("the first key", &entry1)); |
ASSERT_EQ(net::OK, OpenEntry("some other key", &entry2)); |
entry2->Close(); |
@@ -2531,7 +2542,7 @@ TEST_F(DiskCacheBackendTest, NewEvictionInvalidRankingsFailure) { |
// If the LRU is corrupt and we have open entries, we disable the cache. |
void DiskCacheBackendTest::BackendDisable() { |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
void* iter = NULL; |
ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry1)); |
@@ -2630,7 +2641,7 @@ TEST_F(DiskCacheBackendTest, NewEvictionDisableFailure2) { |
// If the index size changes when we disable the cache, we should not crash. |
void DiskCacheBackendTest::BackendDisable3() { |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
void* iter = NULL; |
EXPECT_EQ(2, cache_->GetEntryCount()); |
ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry1)); |
@@ -2664,7 +2675,7 @@ TEST_F(DiskCacheBackendTest, NewEvictionDisableSuccess3) { |
// If we disable the cache, already open entries should work as far as possible. |
void DiskCacheBackendTest::BackendDisable4() { |
- disk_cache::Entry *entry1, *entry2, *entry3, *entry4; |
+ disk_cache::Entry* entry1, *entry2, *entry3, *entry4; |
void* iter = NULL; |
ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry1)); |
@@ -2788,7 +2799,7 @@ TEST_F(DiskCacheBackendTest, Backend_UsageStats) { |
void DiskCacheBackendTest::BackendDoomAll() { |
InitCache(); |
- disk_cache::Entry *entry1, *entry2; |
+ disk_cache::Entry* entry1, *entry2; |
ASSERT_EQ(net::OK, CreateEntry("first", &entry1)); |
ASSERT_EQ(net::OK, CreateEntry("second", &entry2)); |
entry1->Close(); |
@@ -2804,7 +2815,7 @@ void DiskCacheBackendTest::BackendDoomAll() { |
// We should stop posting tasks at some point (if we post any). |
base::MessageLoop::current()->RunUntilIdle(); |
- disk_cache::Entry *entry3, *entry4; |
+ disk_cache::Entry* entry3, *entry4; |
EXPECT_NE(net::OK, OpenEntry("third", &entry3)); |
ASSERT_EQ(net::OK, CreateEntry("third", &entry3)); |
ASSERT_EQ(net::OK, CreateEntry("fourth", &entry4)); |
@@ -2952,8 +2963,7 @@ TEST_F(DiskCacheTest, AutomaticMaxSize) { |
disk_cache::PreferredCacheSize(large_size * 10 - 1)); |
// Region 3: expected = available * 0.1 |
- EXPECT_EQ(kDefaultCacheSize, |
- disk_cache::PreferredCacheSize(large_size * 10)); |
+ EXPECT_EQ(kDefaultCacheSize, disk_cache::PreferredCacheSize(large_size * 10)); |
EXPECT_EQ((kDefaultCacheSize * 25 - 1) / 10, |
disk_cache::PreferredCacheSize(large_size * 25 - 1)); |
@@ -2975,10 +2985,8 @@ TEST_F(DiskCacheTest, AutomaticMaxSize) { |
disk_cache::PreferredCacheSize(largest_size * 100 - 1)); |
// Region 6: expected = largest possible size |
- EXPECT_EQ(largest_size, |
- disk_cache::PreferredCacheSize(largest_size * 100)); |
- EXPECT_EQ(largest_size, |
- disk_cache::PreferredCacheSize(largest_size * 10000)); |
+ EXPECT_EQ(largest_size, disk_cache::PreferredCacheSize(largest_size * 100)); |
+ EXPECT_EQ(largest_size, disk_cache::PreferredCacheSize(largest_size * 10000)); |
} |
// Tests that we can "migrate" a running instance from one experiment group to |
@@ -3073,8 +3081,8 @@ TEST_F(DiskCacheBackendTest, FileSharing) { |
EXPECT_FALSE(file2.IsValid()); |
sharing |= FILE_SHARE_DELETE; |
- file2.Set(CreateFile(name.value().c_str(), access, sharing, NULL, |
- OPEN_EXISTING, 0, NULL)); |
+ file2.Set(CreateFile( |
+ name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL)); |
EXPECT_TRUE(file2.IsValid()); |
#endif |
@@ -3219,7 +3227,7 @@ TEST_F(DiskCacheBackendTest, DISABLED_SimpleCacheSetSize) { |
// MacOS has a default open file limit of 256 files, which is incompatible with |
// this simple cache test. |
#if defined(OS_MACOSX) |
-#define SIMPLE_MAYBE_MACOS(TestName) DISABLED_ ## TestName |
+#define SIMPLE_MAYBE_MACOS(TestName) DISABLED_##TestName |
#else |
#define SIMPLE_MAYBE_MACOS(TestName) TestName |
#endif |
@@ -3329,8 +3337,8 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) { |
header.initial_magic_number = GG_UINT64_C(0xbadf00d); |
EXPECT_EQ( |
implicit_cast<int>(sizeof(header)), |
- base::WriteFile(entry_file1_path, reinterpret_cast<char*>(&header), |
- sizeof(header))); |
+ base::WriteFile( |
+ entry_file1_path, reinterpret_cast<char*>(&header), sizeof(header))); |
ASSERT_EQ(net::ERR_FAILED, OpenEntry(key, &entry)); |
} |
@@ -3422,14 +3430,11 @@ TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationBasics) { |
count = 0; |
disk_cache::Entry* entry_opened_before; |
ASSERT_EQ(net::OK, OpenEntry(*(key_pool.begin()), &entry_opened_before)); |
- ASSERT_TRUE(EnumerateAndMatchKeys(key_pool.size()/2, |
- &iter, |
- &keys_to_match, |
- &count)); |
+ ASSERT_TRUE(EnumerateAndMatchKeys( |
+ key_pool.size() / 2, &iter, &keys_to_match, &count)); |
disk_cache::Entry* entry_opened_middle; |
- ASSERT_EQ(net::OK, |
- OpenEntry(*(keys_to_match.begin()), &entry_opened_middle)); |
+ ASSERT_EQ(net::OK, OpenEntry(*(keys_to_match.begin()), &entry_opened_middle)); |
ASSERT_TRUE(EnumerateAndMatchKeys(-1, &iter, &keys_to_match, &count)); |
cache_->EndEnumeration(&iter); |
entry_opened_before->Close(); |
@@ -3451,10 +3456,8 @@ TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationWhileDoomed) { |
std::set<std::string> keys_to_match(key_pool); |
void* iter = NULL; |
size_t count = 0; |
- ASSERT_TRUE(EnumerateAndMatchKeys(key_pool.size()/2, |
- &iter, |
- &keys_to_match, |
- &count)); |
+ ASSERT_TRUE(EnumerateAndMatchKeys( |
+ key_pool.size() / 2, &iter, &keys_to_match, &count)); |
std::string key_to_delete = *(keys_to_match.begin()); |
DoomEntry(key_to_delete); |
@@ -3490,8 +3493,8 @@ TEST_F(DiskCacheBackendTest, SimpleCacheEnumerationCorruption) { |
ASSERT_EQ(kSize, ReadData(corrupted_entry, 0, 0, buffer.get(), kSize)); |
corrupted_entry->Close(); |
- EXPECT_TRUE(disk_cache::simple_util::CreateCorruptFileForTests( |
- key, cache_path_)); |
+ EXPECT_TRUE( |
+ disk_cache::simple_util::CreateCorruptFileForTests(key, cache_path_)); |
EXPECT_EQ(key_pool.size() + 1, |
implicit_cast<size_t>(cache_->GetEntryCount())); |