summaryrefslogtreecommitdiffstats
path: root/base/file_util_unittest.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 01:50:39 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-21 01:50:39 +0000
commit4b7743de2632a9d226bd5494b90eee6baceb5855 (patch)
treea5101566eecf3e1b66845bd62393f97e4bf509f0 /base/file_util_unittest.cc
parenta0b1c513361089833a7b2ecdc5483eff0d944d60 (diff)
downloadchromium_src-4b7743de2632a9d226bd5494b90eee6baceb5855.zip
chromium_src-4b7743de2632a9d226bd5494b90eee6baceb5855.tar.gz
chromium_src-4b7743de2632a9d226bd5494b90eee6baceb5855.tar.bz2
Implement file_util::CountFilesCreatedAfter() for posix environments.
BUG=9833 Review URL: http://codereview.chromium.org/87003 Patch from Shinichiro Hamaji <hamaji@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_unittest.cc')
-rw-r--r--base/file_util_unittest.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 02ddc0a..7e0a5e5 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -313,15 +313,19 @@ TEST_F(FileUtilTest, GetDirectoryFromPath) {
}
}
-// TODO(erikkay): implement
-#if defined OS_WIN
TEST_F(FileUtilTest, CountFilesCreatedAfter) {
// Create old file (that we don't want to count)
FilePath old_file_name = test_dir_.Append(FILE_PATH_LITERAL("Old File.txt"));
CreateTextFile(old_file_name, L"Just call me Mr. Creakybits");
// Age to perfection
+#if defined(OS_WIN)
Sleep(100);
+#elif defined(OS_POSIX)
+ // We need to wait at least one second here because the precision of
+ // file creation time is one second.
+ sleep(1);
+#endif
// Establish our cutoff time
base::Time now(base::Time::NowFromSystemTime());
@@ -338,7 +342,6 @@ TEST_F(FileUtilTest, CountFilesCreatedAfter) {
EXPECT_TRUE(file_util::Delete(new_file_name, false));
EXPECT_EQ(0, file_util::CountFilesCreatedAfter(test_dir_, now));
}
-#endif
// Tests that the Delete function works as expected, especially
// the recursion flag. Also coincidentally tests PathExists.