| Index: net/disk_cache/simple/simple_index_file_unittest.cc
|
| diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc
|
| index 212320b1025246a2fbec5218bb13308a5f2bacce..6acdcbde43308b1a677ca59dd6b1a7aa224d3214 100644
|
| --- a/net/disk_cache/simple/simple_index_file_unittest.cc
|
| +++ b/net/disk_cache/simple/simple_index_file_unittest.cc
|
| @@ -79,12 +79,9 @@ class WrappedSimpleIndexFile : public SimpleIndexFile {
|
| base::MessageLoopProxy::current().get(),
|
| net::DISK_CACHE,
|
| index_file_directory) {}
|
| - virtual ~WrappedSimpleIndexFile() {
|
| - }
|
| + virtual ~WrappedSimpleIndexFile() {}
|
|
|
| - const base::FilePath& GetIndexFilePath() const {
|
| - return index_file_;
|
| - }
|
| + const base::FilePath& GetIndexFilePath() const { return index_file_; }
|
|
|
| bool CreateIndexFileDirectory() const {
|
| return base::CreateDirectory(index_file_.DirName());
|
| @@ -94,10 +91,9 @@ class WrappedSimpleIndexFile : public SimpleIndexFile {
|
| class SimpleIndexFileTest : public testing::Test {
|
| public:
|
| bool CompareTwoEntryMetadata(const EntryMetadata& a, const EntryMetadata& b) {
|
| - return
|
| - a.last_used_time_seconds_since_epoch_ ==
|
| - b.last_used_time_seconds_since_epoch_ &&
|
| - a.entry_size_ == b.entry_size_;
|
| + return a.last_used_time_seconds_since_epoch_ ==
|
| + b.last_used_time_seconds_since_epoch_ &&
|
| + a.entry_size_ == b.entry_size_;
|
| }
|
|
|
| protected:
|
| @@ -121,7 +117,7 @@ class SimpleIndexFileTest : public testing::Test {
|
|
|
| TEST_F(SimpleIndexFileTest, Serialize) {
|
| SimpleIndex::EntrySet entries;
|
| - static const uint64 kHashes[] = { 11, 22, 33 };
|
| + static const uint64 kHashes[] = {11, 22, 33};
|
| static const size_t kNumHashes = arraysize(kHashes);
|
| EntryMetadata metadata_entries[kNumHashes];
|
|
|
| @@ -133,8 +129,8 @@ TEST_F(SimpleIndexFileTest, Serialize) {
|
| SimpleIndex::InsertInEntrySet(hash, metadata_entries[i], &entries);
|
| }
|
|
|
| - scoped_ptr<Pickle> pickle = WrappedSimpleIndexFile::Serialize(
|
| - index_metadata, entries);
|
| + scoped_ptr<Pickle> pickle =
|
| + WrappedSimpleIndexFile::Serialize(index_metadata, entries);
|
| EXPECT_TRUE(pickle.get() != NULL);
|
| base::Time now = base::Time::Now();
|
| EXPECT_TRUE(WrappedSimpleIndexFile::SerializeFinalData(now, pickle.get()));
|
| @@ -170,14 +166,13 @@ TEST_F(SimpleIndexFileTest, LegacyIsIndexFileStale) {
|
| WrappedSimpleIndexFile::LegacyIsIndexFileStale(cache_mtime, index_path));
|
| const std::string kDummyData = "nothing to be seen here";
|
| EXPECT_EQ(static_cast<int>(kDummyData.size()),
|
| - base::WriteFile(index_path,
|
| - kDummyData.data(), kDummyData.size()));
|
| + base::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
|
| ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
|
| EXPECT_FALSE(
|
| WrappedSimpleIndexFile::LegacyIsIndexFileStale(cache_mtime, index_path));
|
|
|
| - const base::Time past_time = base::Time::Now() -
|
| - base::TimeDelta::FromSeconds(10);
|
| + const base::Time past_time =
|
| + base::Time::Now() - base::TimeDelta::FromSeconds(10);
|
| EXPECT_TRUE(base::TouchFile(index_path, past_time, past_time));
|
| EXPECT_TRUE(base::TouchFile(cache_path, past_time, past_time));
|
| ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
|
| @@ -195,7 +190,7 @@ TEST_F(SimpleIndexFileTest, DISABLED_WriteThenLoadIndex) {
|
| ASSERT_TRUE(cache_dir.CreateUniqueTempDir());
|
|
|
| SimpleIndex::EntrySet entries;
|
| - static const uint64 kHashes[] = { 11, 22, 33 };
|
| + static const uint64 kHashes[] = {11, 22, 33};
|
| static const size_t kNumHashes = arraysize(kHashes);
|
| EntryMetadata metadata_entries[kNumHashes];
|
| for (size_t i = 0; i < kNumHashes; ++i) {
|
| @@ -207,8 +202,8 @@ TEST_F(SimpleIndexFileTest, DISABLED_WriteThenLoadIndex) {
|
| const uint64 kCacheSize = 456U;
|
| {
|
| WrappedSimpleIndexFile simple_index_file(cache_dir.path());
|
| - simple_index_file.WriteToDisk(entries, kCacheSize,
|
| - base::TimeTicks(), false);
|
| + simple_index_file.WriteToDisk(
|
| + entries, kCacheSize, base::TimeTicks(), false);
|
| base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(base::PathExists(simple_index_file.GetIndexFilePath()));
|
| }
|
| @@ -218,9 +213,8 @@ TEST_F(SimpleIndexFileTest, DISABLED_WriteThenLoadIndex) {
|
| ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
|
| &fake_cache_mtime));
|
| SimpleIndexLoadResult load_index_result;
|
| - simple_index_file.LoadIndexEntries(fake_cache_mtime,
|
| - GetCallback(),
|
| - &load_index_result);
|
| + simple_index_file.LoadIndexEntries(
|
| + fake_cache_mtime, GetCallback(), &load_index_result);
|
| base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_TRUE(base::PathExists(simple_index_file.GetIndexFilePath()));
|
| @@ -241,9 +235,8 @@ TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {
|
| ASSERT_TRUE(simple_index_file.CreateIndexFileDirectory());
|
| const base::FilePath& index_path = simple_index_file.GetIndexFilePath();
|
| const std::string kDummyData = "nothing to be seen here";
|
| - EXPECT_EQ(
|
| - implicit_cast<int>(kDummyData.size()),
|
| - base::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
|
| + EXPECT_EQ(implicit_cast<int>(kDummyData.size()),
|
| + base::WriteFile(index_path, kDummyData.data(), kDummyData.size()));
|
| base::Time fake_cache_mtime;
|
| ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
|
| &fake_cache_mtime));
|
| @@ -251,9 +244,8 @@ TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {
|
| index_path));
|
|
|
| SimpleIndexLoadResult load_index_result;
|
| - simple_index_file.LoadIndexEntries(fake_cache_mtime,
|
| - GetCallback(),
|
| - &load_index_result);
|
| + simple_index_file.LoadIndexEntries(
|
| + fake_cache_mtime, GetCallback(), &load_index_result);
|
| base::RunLoop().RunUntilIdle();
|
|
|
| EXPECT_FALSE(base::PathExists(index_path));
|
| @@ -275,8 +267,8 @@ TEST_F(SimpleIndexFileTest, SimpleCacheUpgrade) {
|
| disk_cache::FakeIndexData file_contents;
|
| file_contents.initial_magic_number = disk_cache::kSimpleInitialMagicNumber;
|
| file_contents.version = 5;
|
| - int bytes_written = file.Write(0, reinterpret_cast<char*>(&file_contents),
|
| - sizeof(file_contents));
|
| + int bytes_written = file.Write(
|
| + 0, reinterpret_cast<char*>(&file_contents), sizeof(file_contents));
|
| ASSERT_EQ((int)sizeof(file_contents), bytes_written);
|
| file.Close();
|
|
|
|
|