| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Aggregates notifications from the test delegates and breaks the message loop | 49 // Aggregates notifications from the test delegates and breaks the message loop |
| 50 // the test thread is waiting on once they all came in. | 50 // the test thread is waiting on once they all came in. |
| 51 class NotificationCollector | 51 class NotificationCollector |
| 52 : public base::RefCountedThreadSafe<NotificationCollector> { | 52 : public base::RefCountedThreadSafe<NotificationCollector> { |
| 53 public: | 53 public: |
| 54 NotificationCollector() : task_runner_(base::ThreadTaskRunnerHandle::Get()) {} | 54 NotificationCollector() : task_runner_(base::ThreadTaskRunnerHandle::Get()) {} |
| 55 | 55 |
| 56 // Called from the file thread by the delegates. | 56 // Called from the file thread by the delegates. |
| 57 void OnChange(TestDelegate* delegate) { | 57 void OnChange(TestDelegate* delegate) { |
| 58 task_runner_->PostTask( | 58 task_runner_->PostTask( |
| 59 FROM_HERE, base::Bind(&NotificationCollector::RecordChange, this, | 59 FROM_HERE, base::BindOnce(&NotificationCollector::RecordChange, this, |
| 60 base::Unretained(delegate))); | 60 base::Unretained(delegate))); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void Register(TestDelegate* delegate) { | 63 void Register(TestDelegate* delegate) { |
| 64 delegates_.insert(delegate); | 64 delegates_.insert(delegate); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void Reset() { | 67 void Reset() { |
| 68 signaled_.clear(); | 68 signaled_.clear(); |
| 69 } | 69 } |
| 70 | 70 |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 // longer access the file | 863 // longer access the file |
| 864 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); | 864 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); |
| 865 ASSERT_TRUE(WaitForEvents()); | 865 ASSERT_TRUE(WaitForEvents()); |
| 866 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); | 866 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); |
| 867 } | 867 } |
| 868 | 868 |
| 869 #endif // OS_MACOSX | 869 #endif // OS_MACOSX |
| 870 } // namespace | 870 } // namespace |
| 871 | 871 |
| 872 } // namespace base | 872 } // namespace base |
| OLD | NEW |