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 23 matching lines...) Expand all Loading... |
34 namespace { | 34 namespace { |
35 | 35 |
36 class TestDelegate; | 36 class TestDelegate; |
37 | 37 |
38 // Aggregates notifications from the test delegates and breaks the message loop | 38 // Aggregates notifications from the test delegates and breaks the message loop |
39 // the test thread is waiting on once they all came in. | 39 // the test thread is waiting on once they all came in. |
40 class NotificationCollector | 40 class NotificationCollector |
41 : public base::RefCountedThreadSafe<NotificationCollector> { | 41 : public base::RefCountedThreadSafe<NotificationCollector> { |
42 public: | 42 public: |
43 NotificationCollector() | 43 NotificationCollector() |
44 : loop_(base::MessageLoopProxy::CreateForCurrentThread()) {} | 44 : loop_(base::MessageLoopProxy::current()) {} |
45 | 45 |
46 // Called from the file thread by the delegates. | 46 // Called from the file thread by the delegates. |
47 void OnChange(TestDelegate* delegate) { | 47 void OnChange(TestDelegate* delegate) { |
48 loop_->PostTask(FROM_HERE, | 48 loop_->PostTask(FROM_HERE, |
49 NewRunnableMethod(this, | 49 NewRunnableMethod(this, |
50 &NotificationCollector::RecordChange, | 50 &NotificationCollector::RecordChange, |
51 make_scoped_refptr(delegate))); | 51 make_scoped_refptr(delegate))); |
52 } | 52 } |
53 | 53 |
54 void Register(TestDelegate* delegate) { | 54 void Register(TestDelegate* delegate) { |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); | 619 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); |
620 ASSERT_TRUE(WaitForEvents()); | 620 ASSERT_TRUE(WaitForEvents()); |
621 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); | 621 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); |
622 } | 622 } |
623 | 623 |
624 #endif // OS_MACOSX | 624 #endif // OS_MACOSX |
625 } // namespace | 625 } // namespace |
626 | 626 |
627 } // namespace files | 627 } // namespace files |
628 } // namespace base | 628 } // namespace base |
OLD | NEW |