Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: base/files/file_path_watcher_unittest.cc

Issue 2032603002: Migrate WaitableEvent to enum-based constructor in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: undo incorrect template change Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/allocator/allocator_shim_unittest.cc ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 scoped_refptr<NotificationCollector> collector_; 208 scoped_refptr<NotificationCollector> collector_;
209 209
210 private: 210 private:
211 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherTest); 211 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherTest);
212 }; 212 };
213 213
214 bool FilePathWatcherTest::SetupWatch(const FilePath& target, 214 bool FilePathWatcherTest::SetupWatch(const FilePath& target,
215 FilePathWatcher* watcher, 215 FilePathWatcher* watcher,
216 TestDelegateBase* delegate, 216 TestDelegateBase* delegate,
217 bool recursive_watch) { 217 bool recursive_watch) {
218 base::WaitableEvent completion(false, false); 218 base::WaitableEvent completion(WaitableEvent::ResetPolicy::AUTOMATIC,
219 WaitableEvent::InitialState::NOT_SIGNALED);
219 bool result; 220 bool result;
220 file_thread_.task_runner()->PostTask( 221 file_thread_.task_runner()->PostTask(
221 FROM_HERE, base::Bind(SetupWatchCallback, target, watcher, delegate, 222 FROM_HERE, base::Bind(SetupWatchCallback, target, watcher, delegate,
222 recursive_watch, &result, &completion)); 223 recursive_watch, &result, &completion));
223 completion.Wait(); 224 completion.Wait();
224 return result; 225 return result;
225 } 226 }
226 227
227 // Basic test: Create the file and verify that we notice. 228 // Basic test: Create the file and verify that we notice.
228 TEST_F(FilePathWatcherTest, NewFile) { 229 TEST_F(FilePathWatcherTest, NewFile) {
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); 901 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false));
901 ASSERT_TRUE(WaitForEvents()); 902 ASSERT_TRUE(WaitForEvents());
902 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); 903 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true));
903 DeleteDelegateOnFileThread(delegate.release()); 904 DeleteDelegateOnFileThread(delegate.release());
904 } 905 }
905 906
906 #endif // OS_MACOSX 907 #endif // OS_MACOSX
907 } // namespace 908 } // namespace
908 909
909 } // namespace base 910 } // namespace base
OLDNEW
« no previous file with comments | « base/allocator/allocator_shim_unittest.cc ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698