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 |