OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/files/file_path_watcher.h" | 5 #include "base/files/file_path_watcher.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 // We win if we haven't crashed yet. | 264 // We win if we haven't crashed yet. |
265 // Might as well double-check it got deleted, too. | 265 // Might as well double-check it got deleted, too. |
266 ASSERT_TRUE(deleter->watcher_.get() == NULL); | 266 ASSERT_TRUE(deleter->watcher_.get() == NULL); |
267 } | 267 } |
268 | 268 |
269 // Verify that deleting the watcher works even if there is a pending | 269 // Verify that deleting the watcher works even if there is a pending |
270 // notification. | 270 // notification. |
271 // Flaky on MacOS. http://crbug.com/85930 | 271 // Flaky on MacOS. http://crbug.com/85930 |
272 #if defined(OS_MACOSX) | 272 #if defined(OS_MACOSX) |
273 #define MAYBE_DestroyWithPendingNotification FLAKY_DestroyWithPendingNotificatio
n | 273 #define MAYBE_DestroyWithPendingNotification DISABLED_DestroyWithPendingNotifica
tion |
274 #else | 274 #else |
275 #define MAYBE_DestroyWithPendingNotification DestroyWithPendingNotification | 275 #define MAYBE_DestroyWithPendingNotification DestroyWithPendingNotification |
276 #endif | 276 #endif |
277 TEST_F(FilePathWatcherTest, MAYBE_DestroyWithPendingNotification) { | 277 TEST_F(FilePathWatcherTest, MAYBE_DestroyWithPendingNotification) { |
278 scoped_refptr<TestDelegate> delegate(new TestDelegate(collector())); | 278 scoped_refptr<TestDelegate> delegate(new TestDelegate(collector())); |
279 FilePathWatcher* watcher = new FilePathWatcher; | 279 FilePathWatcher* watcher = new FilePathWatcher; |
280 ASSERT_TRUE(SetupWatch(test_file(), watcher, delegate.get())); | 280 ASSERT_TRUE(SetupWatch(test_file(), watcher, delegate.get())); |
281 ASSERT_TRUE(WriteFile(test_file(), "content")); | 281 ASSERT_TRUE(WriteFile(test_file(), "content")); |
282 file_thread_.message_loop_proxy()->DeleteSoon(FROM_HERE, watcher); | 282 file_thread_.message_loop_proxy()->DeleteSoon(FROM_HERE, watcher); |
283 } | 283 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 VLOG(1) << "Waiting for file creation"; | 345 VLOG(1) << "Waiting for file creation"; |
346 ASSERT_TRUE(WaitForEvents()); | 346 ASSERT_TRUE(WaitForEvents()); |
347 | 347 |
348 ASSERT_TRUE(WriteFile(file, "content v2")); | 348 ASSERT_TRUE(WriteFile(file, "content v2")); |
349 VLOG(1) << "Waiting for file modification"; | 349 VLOG(1) << "Waiting for file modification"; |
350 ASSERT_TRUE(WaitForEvents()); | 350 ASSERT_TRUE(WaitForEvents()); |
351 } | 351 } |
352 | 352 |
353 #if defined(OS_MACOSX) | 353 #if defined(OS_MACOSX) |
354 // http://crbug.com/85930 | 354 // http://crbug.com/85930 |
355 #define DisappearingDirectory FLAKY_DisappearingDirectory | 355 #define DisappearingDirectory DISABLED_DisappearingDirectory |
356 #endif | 356 #endif |
357 TEST_F(FilePathWatcherTest, DisappearingDirectory) { | 357 TEST_F(FilePathWatcherTest, DisappearingDirectory) { |
358 FilePathWatcher watcher; | 358 FilePathWatcher watcher; |
359 FilePath dir(temp_dir_.path().AppendASCII("dir")); | 359 FilePath dir(temp_dir_.path().AppendASCII("dir")); |
360 FilePath file(dir.AppendASCII("file")); | 360 FilePath file(dir.AppendASCII("file")); |
361 ASSERT_TRUE(file_util::CreateDirectory(dir)); | 361 ASSERT_TRUE(file_util::CreateDirectory(dir)); |
362 ASSERT_TRUE(WriteFile(file, "content")); | 362 ASSERT_TRUE(WriteFile(file, "content")); |
363 scoped_refptr<TestDelegate> delegate(new TestDelegate(collector())); | 363 scoped_refptr<TestDelegate> delegate(new TestDelegate(collector())); |
364 ASSERT_TRUE(SetupWatch(file, &watcher, delegate.get())); | 364 ASSERT_TRUE(SetupWatch(file, &watcher, delegate.get())); |
365 | 365 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); | 766 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); |
767 ASSERT_TRUE(WaitForEvents()); | 767 ASSERT_TRUE(WaitForEvents()); |
768 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); | 768 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); |
769 } | 769 } |
770 | 770 |
771 #endif // OS_MACOSX | 771 #endif // OS_MACOSX |
772 } // namespace | 772 } // namespace |
773 | 773 |
774 } // namespace files | 774 } // namespace files |
775 } // namespace base | 775 } // namespace base |
OLD | NEW |