OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 | 750 |
751 FilePathWatcher watcher; | 751 FilePathWatcher watcher; |
752 scoped_refptr<TestDelegate> delegate(new TestDelegate(collector())); | 752 scoped_refptr<TestDelegate> delegate(new TestDelegate(collector())); |
753 ASSERT_TRUE(SetupWatch(test_file, &watcher, delegate.get())); | 753 ASSERT_TRUE(SetupWatch(test_file, &watcher, delegate.get())); |
754 | 754 |
755 // We should not get notified in this case as it hasn't affected our ability | 755 // We should not get notified in this case as it hasn't affected our ability |
756 // to access the file. | 756 // to access the file. |
757 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Read, false)); | 757 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Read, false)); |
758 loop_.PostDelayedTask(FROM_HERE, | 758 loop_.PostDelayedTask(FROM_HERE, |
759 MessageLoop::QuitClosure(), | 759 MessageLoop::QuitClosure(), |
760 TestTimeouts::tiny_timeout_ms()); | 760 TestTimeouts::tiny_timeout()); |
761 ASSERT_FALSE(WaitForEvents()); | 761 ASSERT_FALSE(WaitForEvents()); |
762 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Read, true)); | 762 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Read, true)); |
763 | 763 |
764 // We should get notified in this case because filepathwatcher can no | 764 // We should get notified in this case because filepathwatcher can no |
765 // longer access the file | 765 // longer access the file |
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 |