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

Unified Diff: base/directory_watcher_unittest.cc

Issue 92151: Add support for almost-recursive watches in Linux DirectoryWatcher... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 7 months 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_inotify.cc ('k') | base/file_util.h » ('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 15554)
+++ base/directory_watcher_unittest.cc (working copy)
@@ -23,6 +23,8 @@
// For tests where we wait a bit to verify nothing happened
const int kWaitForEventTime = 1000;
+} // namespace
+
class DirectoryWatcherTest : public testing::Test {
public:
// Implementation of DirectoryWatcher on Mac requires UI loop.
@@ -209,17 +211,13 @@
TEST_F(DirectoryWatcherTest, SubDirRecursive) {
FilePath subdir(CreateTestDirDirectoryASCII("SubDir", true));
-#if defined(OS_LINUX)
- // TODO(port): Recursive watches are not implemented on Linux.
- return;
-#endif // !defined(OS_WIN)
-
// Verify that modifications to a subdirectory are noticed by recursive watch.
TestDelegate delegate(this);
DirectoryWatcher watcher;
ASSERT_TRUE(watcher.Watch(test_dir_, &delegate, true));
// Write a file to the subdir.
SetExpectedNumberOfNotifiedDelegates(1);
+ watcher.EnsureSetupFinished();
ASSERT_TRUE(WriteTestFile(subdir.AppendASCII("test_file"), "some content"));
VerifyExpectedNumberOfNotifiedDelegates();
}
@@ -304,7 +302,7 @@
FilePath subdirs[kNumberOfWatchers];
for (int i = 0; i < kNumberOfWatchers; i++) {
subdirs[i] = CreateTestDirDirectoryASCII("Dir" + IntToString(i), false);
- ASSERT_TRUE(watchers[i].Watch(subdirs[i], &delegates[i], false));
+ ASSERT_TRUE(watchers[i].Watch(subdirs[i], &delegates[i], ((i % 2) == 0)));
}
for (int i = 0; i < kNumberOfWatchers; i++) {
// Verify that we only get modifications from one watcher (each watcher has
@@ -343,6 +341,7 @@
ASSERT_TRUE(WriteTestFile(subdir.AppendASCII("test_file"), "other content"));
VerifyExpectedNumberOfNotifiedDelegates();
}
+#endif // defined(OS_WIN) || defined(OS_MACOSX)
TEST_F(DirectoryWatcherTest, RecursiveWatchDeletedSubdirectory) {
FilePath subdir(CreateTestDirDirectoryASCII("SubDir", true));
@@ -353,6 +352,7 @@
// Write a file to the subdir.
SetExpectedNumberOfNotifiedDelegates(1);
+ watcher.EnsureSetupFinished();
ASSERT_TRUE(WriteTestFile(subdir.AppendASCII("test_file"), "some content"));
VerifyExpectedNumberOfNotifiedDelegates();
@@ -392,7 +392,6 @@
ASSERT_TRUE(WriteTestFile(subdir2.AppendASCII("file"), "other content"));
VerifyExpectedNumberOfNotifiedDelegates();
}
-#endif // defined(OS_WIN) || defined(OS_MACOSX)
Paweł Hajdan Jr. 2009/05/12 07:26:37 Let's not move this line at this point. I will fix
// Verify that watching a directory that doesn't exist fails, but doesn't
// asssert.
@@ -403,4 +402,3 @@
false));
}
-} // namespace
« no previous file with comments | « base/directory_watcher_inotify.cc ('k') | base/file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698