summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/directory_watcher_unittest.cc19
-rw-r--r--base/directory_watcher_win.cc4
2 files changed, 5 insertions, 18 deletions
diff --git a/base/directory_watcher_unittest.cc b/base/directory_watcher_unittest.cc
index 23ae803..7280dff 100644
--- a/base/directory_watcher_unittest.cc
+++ b/base/directory_watcher_unittest.cc
@@ -128,15 +128,8 @@ TEST_F(DirectoryWatcherTest, Unregister) {
ASSERT_EQ(directory_mods_, 0);
}
-// Verify that modifications to a subdirectory isn't noticed.
+// Verify that modifications to a subdirectory are noticed.
TEST_F(DirectoryWatcherTest, SubDir) {
-#if defined(OS_WIN)
- // Temporarily disabling test on Vista, see
- // http://code.google.com/p/chromium/issues/detail?id=5072
- // TODO: Enable this test, quickly.
- if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA)
- return;
-#endif
FilePath subdir(FILE_PATH_LITERAL("SubDir"));
ASSERT_TRUE(file_util::CreateDirectory(test_dir_.Append(subdir)));
@@ -145,15 +138,7 @@ TEST_F(DirectoryWatcherTest, SubDir) {
// Write a file to the subdir.
FilePath test_path = subdir.AppendASCII("test_file");
WriteTestDirFile(test_path.value(), "some content");
-
- // We won't get a notification, so we just wait around a bit to verify
- // that notification doesn't come.
- loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask,
- kWaitForEventTime);
- loop_.Run();
-
- // We shouldn't have been notified and shouldn't have crashed.
- ASSERT_EQ(0, directory_mods_);
+ LoopUntilModsEqual(2);
}
namespace {
diff --git a/base/directory_watcher_win.cc b/base/directory_watcher_win.cc
index 6fe6ba5..f978277 100644
--- a/base/directory_watcher_win.cc
+++ b/base/directory_watcher_win.cc
@@ -43,9 +43,11 @@ DirectoryWatcher::Impl::~Impl() {
bool DirectoryWatcher::Impl::Watch(const FilePath& path) {
DCHECK(path_.value().empty()); // Can only watch one path.
+ // NOTE: If you want to change this code to *not* watch subdirectories, have a
+ // look at http://code.google.com/p/chromium/issues/detail?id=5072 first.
handle_ = FindFirstChangeNotification(
path.value().c_str(),
- FALSE, // Don't watch subtree.
+ TRUE, // Watch subtree.
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE |
FILE_NOTIFY_CHANGE_LAST_WRITE);
if (handle_ == INVALID_HANDLE_VALUE)