| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 FilePath test_file() { | 165 FilePath test_file() { |
| 166 return temp_dir_.path().AppendASCII("FilePathWatcherTest"); | 166 return temp_dir_.path().AppendASCII("FilePathWatcherTest"); |
| 167 } | 167 } |
| 168 | 168 |
| 169 FilePath test_link() { | 169 FilePath test_link() { |
| 170 return temp_dir_.path().AppendASCII("FilePathWatcherTest.lnk"); | 170 return temp_dir_.path().AppendASCII("FilePathWatcherTest.lnk"); |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Write |content| to |file|. Returns true on success. | 173 // Write |content| to |file|. Returns true on success. |
| 174 bool WriteFile(const FilePath& file, const std::string& content) { | 174 bool WriteFile(const FilePath& file, const std::string& content) { |
| 175 int write_size = file_util::WriteFile(file, content.c_str(), | 175 int write_size = ::base::WriteFile(file, content.c_str(), content.length()); |
| 176 content.length()); | |
| 177 return write_size == static_cast<int>(content.length()); | 176 return write_size == static_cast<int>(content.length()); |
| 178 } | 177 } |
| 179 | 178 |
| 180 bool SetupWatch(const FilePath& target, | 179 bool SetupWatch(const FilePath& target, |
| 181 FilePathWatcher* watcher, | 180 FilePathWatcher* watcher, |
| 182 TestDelegateBase* delegate, | 181 TestDelegateBase* delegate, |
| 183 bool recursive_watch) WARN_UNUSED_RESULT; | 182 bool recursive_watch) WARN_UNUSED_RESULT; |
| 184 | 183 |
| 185 bool WaitForEvents() WARN_UNUSED_RESULT { | 184 bool WaitForEvents() WARN_UNUSED_RESULT { |
| 186 collector_->Reset(); | 185 collector_->Reset(); |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); | 833 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); |
| 835 ASSERT_TRUE(WaitForEvents()); | 834 ASSERT_TRUE(WaitForEvents()); |
| 836 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); | 835 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); |
| 837 DeleteDelegateOnFileThread(delegate.release()); | 836 DeleteDelegateOnFileThread(delegate.release()); |
| 838 } | 837 } |
| 839 | 838 |
| 840 #endif // OS_MACOSX | 839 #endif // OS_MACOSX |
| 841 } // namespace | 840 } // namespace |
| 842 | 841 |
| 843 } // namespace base | 842 } // namespace base |
| OLD | NEW |