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

Unified Diff: base/directory_watcher_unittest.cc

Issue 13255: Properly fix DirWatcherTest.SubDir on Vista. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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 | « base/directory_watcher.h ('k') | base/directory_watcher_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/directory_watcher_unittest.cc
===================================================================
--- base/directory_watcher_unittest.cc (revision 6529)
+++ base/directory_watcher_unittest.cc (working copy)
@@ -6,17 +6,13 @@
#include <fstream>
-#include "build/build_config.h"
-
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "base/platform_thread.h"
#include "base/string_util.h"
-#if defined(OS_WIN)
-#include "base/win_util.h"
-#endif
#include "testing/gtest/include/gtest/gtest.h"
// For tests where we wait a bit to verify nothing happened
@@ -43,6 +39,7 @@
}
virtual void OnDirectoryChanged(const FilePath& path) {
+ EXPECT_EQ(path.value(), test_dir_.value());
++directory_mods_;
if (directory_mods_ == quit_mod_count_)
MessageLoop::current()->Quit();
@@ -93,6 +90,16 @@
LoopUntilModsEqual(2);
}
+TEST_F(DirectoryWatcherTest, NewDir) {
+ DirectoryWatcher watcher;
+ ASSERT_TRUE(watcher.Watch(test_dir_, this));
+
+ FilePath subdir(FILE_PATH_LITERAL("SubDir"));
+ ASSERT_TRUE(file_util::CreateDirectory(test_dir_.Append(subdir)));
+
+ LoopUntilModsEqual(1);
+}
+
// Verify that modifying a file is caught.
TEST_F(DirectoryWatcherTest, ModifiedFile) {
DirectoryWatcher watcher;
@@ -130,18 +137,18 @@
// Verify that modifications to a subdirectory isn't 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
+ DirectoryWatcher watcher;
+ ASSERT_TRUE(watcher.Watch(test_dir_, this));
+
FilePath subdir(FILE_PATH_LITERAL("SubDir"));
ASSERT_TRUE(file_util::CreateDirectory(test_dir_.Append(subdir)));
- DirectoryWatcher watcher;
- ASSERT_TRUE(watcher.Watch(test_dir_, this));
+ LoopUntilModsEqual(1);
+
+ // Wait to make sure we also clear some late notifications.
+ PlatformThread::Sleep(2 * kWaitForEventTime);
+ directory_mods_ = 0;
+
// Write a file to the subdir.
FilePath test_path = subdir.Append(FILE_PATH_LITERAL("test_file"));
WriteTestDirFile(test_path.value(), "some content");
« no previous file with comments | « base/directory_watcher.h ('k') | base/directory_watcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698