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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <aclapi.h> | 9 #include <aclapi.h> |
10 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 bool SetupWatch(const FilePath& target, | 192 bool SetupWatch(const FilePath& target, |
193 FilePathWatcher* watcher, | 193 FilePathWatcher* watcher, |
194 TestDelegateBase* delegate, | 194 TestDelegateBase* delegate, |
195 bool recursive_watch) WARN_UNUSED_RESULT; | 195 bool recursive_watch) WARN_UNUSED_RESULT; |
196 | 196 |
197 bool WaitForEvents() WARN_UNUSED_RESULT { | 197 bool WaitForEvents() WARN_UNUSED_RESULT { |
198 collector_->Reset(); | 198 collector_->Reset(); |
199 // Make sure we timeout if we don't get notified. | 199 // Make sure we timeout if we don't get notified. |
200 loop_.PostDelayedTask(FROM_HERE, | 200 loop_.task_runner()->PostDelayedTask(FROM_HERE, |
201 MessageLoop::QuitWhenIdleClosure(), | 201 MessageLoop::QuitWhenIdleClosure(), |
202 TestTimeouts::action_timeout()); | 202 TestTimeouts::action_timeout()); |
203 RunLoop().Run(); | 203 RunLoop().Run(); |
204 return collector_->Success(); | 204 return collector_->Success(); |
205 } | 205 } |
206 | 206 |
207 NotificationCollector* collector() { return collector_.get(); } | 207 NotificationCollector* collector() { return collector_.get(); } |
208 | 208 |
209 MessageLoop loop_; | 209 MessageLoop loop_; |
210 base::Thread file_thread_; | 210 base::Thread file_thread_; |
211 ScopedTempDir temp_dir_; | 211 ScopedTempDir temp_dir_; |
212 scoped_refptr<NotificationCollector> collector_; | 212 scoped_refptr<NotificationCollector> collector_; |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); | 905 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); |
906 ASSERT_TRUE(WaitForEvents()); | 906 ASSERT_TRUE(WaitForEvents()); |
907 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); | 907 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); |
908 DeleteDelegateOnFileThread(delegate.release()); | 908 DeleteDelegateOnFileThread(delegate.release()); |
909 } | 909 } |
910 | 910 |
911 #endif // OS_MACOSX | 911 #endif // OS_MACOSX |
912 } // namespace | 912 } // namespace |
913 | 913 |
914 } // namespace base | 914 } // namespace base |
OLD | NEW |