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


CrOS-Libchrome-Original-Commit: 4b7743de2632a9d226bd5494b90eee6baceb5855
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 @@
   }
 }
 
-// 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 @@
   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.