summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 15:48:53 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-24 15:48:53 +0000
commit9b9add0e3670491fc15828af54769dc4347af228 (patch)
tree815bef16ac35e585fb85ddc705f56197c6d8af33
parent13ab8bf98763070a06215553e6f79a6cc16f2bdb (diff)
downloadchromium_src-9b9add0e3670491fc15828af54769dc4347af228.zip
chromium_src-9b9add0e3670491fc15828af54769dc4347af228.tar.gz
chromium_src-9b9add0e3670491fc15828af54769dc4347af228.tar.bz2
Disable DirectoryWatcherTest.SubDirNonRecursive on Windows versions
earlier than Vista. Review URL: http://codereview.chromium.org/42564 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12361 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/directory_watcher.h7
-rw-r--r--base/directory_watcher_unittest.cc10
2 files changed, 14 insertions, 3 deletions
diff --git a/base/directory_watcher.h b/base/directory_watcher.h
index 15f24df..ae01149 100644
--- a/base/directory_watcher.h
+++ b/base/directory_watcher.h
@@ -30,9 +30,10 @@ class DirectoryWatcher {
// If |recursive| is true, the delegate will be notified for each change
// within the directory tree starting at |path|. Returns false on error.
//
- // Note: on Windows the non-recursive watch will also send a notification
- // when you create a file in a subdirectory (but won't send notifications
- // for further modifications).
+ // Note: on Windows you may got more notifications for non-recursive watch
+ // than you expect, especially on versions earlier than Vista. The behavior
+ // is consistent on any particular version of Windows, but not across
+ // different versions.
bool Watch(const FilePath& path, Delegate* delegate, bool recursive) {
return impl_->Watch(path, delegate, recursive);
}
diff --git a/base/directory_watcher_unittest.cc b/base/directory_watcher_unittest.cc
index 20ec4897..fabd46f 100644
--- a/base/directory_watcher_unittest.cc
+++ b/base/directory_watcher_unittest.cc
@@ -13,6 +13,9 @@
#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 // defined(OS_WIN)
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -171,6 +174,13 @@ TEST_F(DirectoryWatcherTest, SubDirRecursive) {
}
TEST_F(DirectoryWatcherTest, SubDirNonRecursive) {
+#if defined(OS_WIN)
+ // Disable this test for earlier version of Windows. It turned out to be
+ // very difficult to create a reliable test for them.
+ if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA)
+ return;
+#endif // defined(OS_WIN)
+
FilePath subdir(FILE_PATH_LITERAL("SubDir"));
ASSERT_TRUE(file_util::CreateDirectory(test_dir_.Append(subdir)));