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

Unified Diff: net/disk_cache/simple/simple_index_file_unittest.cc

Issue 22571011: Remove simple_util::GetMTime from simple cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months 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/simple/simple_index_file.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cf3b594cb3f300686b1a1ebfefbcd9c64af9df4a..91051413e3e496f2964c0b601c34315c4bb8b512 100644
--- a/net/disk_cache/simple/simple_index_file_unittest.cc
+++ b/net/disk_cache/simple/simple_index_file_unittest.cc
@@ -136,34 +136,34 @@ TEST_F(SimpleIndexFileTest, Serialize) {
TEST_F(SimpleIndexFileTest, IsIndexFileStale) {
base::ScopedTempDir cache_dir;
ASSERT_TRUE(cache_dir.CreateUniqueTempDir());
- base::Time cache_mtime;
+ base::PlatformFileInfo file_info;
const base::FilePath cache_path = cache_dir.path();
- ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
+ ASSERT_TRUE(file_util::GetFileInfo(cache_path, &file_info));
WrappedSimpleIndexFile simple_index_file(cache_path);
const base::FilePath& index_path = simple_index_file.GetIndexFilePath();
- EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+ EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(file_info.last_modified,
index_path));
const std::string kDummyData = "nothing to be seen here";
EXPECT_EQ(static_cast<int>(kDummyData.size()),
file_util::WriteFile(index_path,
kDummyData.data(),
kDummyData.size()));
- ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
- EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+ ASSERT_TRUE(file_util::GetFileInfo(cache_path, &file_info));
+ EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(file_info.last_modified,
index_path));
const base::Time past_time = base::Time::Now() -
base::TimeDelta::FromSeconds(10);
EXPECT_TRUE(file_util::TouchFile(index_path, past_time, past_time));
EXPECT_TRUE(file_util::TouchFile(cache_path, past_time, past_time));
- ASSERT_TRUE(simple_util::GetMTime(cache_path, &cache_mtime));
- EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+ ASSERT_TRUE(file_util::GetFileInfo(cache_path, &file_info));
+ EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(file_info.last_modified,
index_path));
const base::Time even_older =
past_time - base::TimeDelta::FromSeconds(10);
EXPECT_TRUE(file_util::TouchFile(index_path, even_older, even_older));
- EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(cache_mtime,
+ EXPECT_TRUE(WrappedSimpleIndexFile::IsIndexFileStale(file_info.last_modified,
index_path));
}
@@ -192,11 +192,11 @@ TEST_F(SimpleIndexFileTest, WriteThenLoadIndex) {
}
WrappedSimpleIndexFile simple_index_file(cache_dir.path());
- base::Time fake_cache_mtime;
- ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
- &fake_cache_mtime));
+ base::PlatformFileInfo file_info;
+ ASSERT_TRUE(file_util::GetFileInfo(simple_index_file.GetIndexFilePath(),
+ &file_info));
SimpleIndexLoadResult load_index_result;
- simple_index_file.LoadIndexEntries(fake_cache_mtime,
+ simple_index_file.LoadIndexEntries(file_info.last_modified,
GetCallback(),
&load_index_result);
base::RunLoop().RunUntilIdle();
@@ -222,14 +222,14 @@ TEST_F(SimpleIndexFileTest, LoadCorruptIndex) {
file_util::WriteFile(index_path,
kDummyData.data(),
kDummyData.size()));
- base::Time fake_cache_mtime;
- ASSERT_TRUE(simple_util::GetMTime(simple_index_file.GetIndexFilePath(),
- &fake_cache_mtime));
- EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(fake_cache_mtime,
+ base::PlatformFileInfo file_info;
+ ASSERT_TRUE(file_util::GetFileInfo(simple_index_file.GetIndexFilePath(),
+ &file_info));
+ EXPECT_FALSE(WrappedSimpleIndexFile::IsIndexFileStale(file_info.last_modified,
index_path));
SimpleIndexLoadResult load_index_result;
- simple_index_file.LoadIndexEntries(fake_cache_mtime,
+ simple_index_file.LoadIndexEntries(file_info.last_modified,
GetCallback(),
&load_index_result);
base::RunLoop().RunUntilIdle();
« no previous file with comments | « net/disk_cache/simple/simple_index_file.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698