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

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

Issue 444163003: Move the rest of test_file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « base/file_util_unittest.cc ('k') | base/test/run_all_unittests.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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Create "$dir/subdir/subdir_child_dir/child_dir_file1". 521 // Create "$dir/subdir/subdir_child_dir/child_dir_file1".
522 FilePath child_dir_file1(subdir_child_dir.AppendASCII("child_dir_file1")); 522 FilePath child_dir_file1(subdir_child_dir.AppendASCII("child_dir_file1"));
523 ASSERT_TRUE(WriteFile(child_dir_file1, "content v2")); 523 ASSERT_TRUE(WriteFile(child_dir_file1, "content v2"));
524 ASSERT_TRUE(WaitForEvents()); 524 ASSERT_TRUE(WaitForEvents());
525 525
526 // Write into "$dir/subdir/subdir_child_dir/child_dir_file1". 526 // Write into "$dir/subdir/subdir_child_dir/child_dir_file1".
527 ASSERT_TRUE(WriteFile(child_dir_file1, "content")); 527 ASSERT_TRUE(WriteFile(child_dir_file1, "content"));
528 ASSERT_TRUE(WaitForEvents()); 528 ASSERT_TRUE(WaitForEvents());
529 529
530 // Modify "$dir/subdir/subdir_child_dir/child_dir_file1" attributes. 530 // Modify "$dir/subdir/subdir_child_dir/child_dir_file1" attributes.
531 ASSERT_TRUE(file_util::MakeFileUnreadable(child_dir_file1)); 531 ASSERT_TRUE(base::MakeFileUnreadable(child_dir_file1));
532 ASSERT_TRUE(WaitForEvents()); 532 ASSERT_TRUE(WaitForEvents());
533 533
534 // Delete "$dir/subdir/subdir_file1". 534 // Delete "$dir/subdir/subdir_file1".
535 ASSERT_TRUE(base::DeleteFile(subdir_file1, false)); 535 ASSERT_TRUE(base::DeleteFile(subdir_file1, false));
536 ASSERT_TRUE(WaitForEvents()); 536 ASSERT_TRUE(WaitForEvents());
537 537
538 // Delete "$dir/subdir/subdir_child_dir/child_dir_file1". 538 // Delete "$dir/subdir/subdir_child_dir/child_dir_file1".
539 ASSERT_TRUE(base::DeleteFile(child_dir_file1, false)); 539 ASSERT_TRUE(base::DeleteFile(child_dir_file1, false));
540 ASSERT_TRUE(WaitForEvents()); 540 ASSERT_TRUE(WaitForEvents());
541 DeleteDelegateOnFileThread(delegate.release()); 541 DeleteDelegateOnFileThread(delegate.release());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 611 }
612 612
613 // Verify that changing attributes on a file is caught 613 // Verify that changing attributes on a file is caught
614 TEST_F(FilePathWatcherTest, FileAttributesChanged) { 614 TEST_F(FilePathWatcherTest, FileAttributesChanged) {
615 ASSERT_TRUE(WriteFile(test_file(), "content")); 615 ASSERT_TRUE(WriteFile(test_file(), "content"));
616 FilePathWatcher watcher; 616 FilePathWatcher watcher;
617 scoped_ptr<TestDelegate> delegate(new TestDelegate(collector())); 617 scoped_ptr<TestDelegate> delegate(new TestDelegate(collector()));
618 ASSERT_TRUE(SetupWatch(test_file(), &watcher, delegate.get(), false)); 618 ASSERT_TRUE(SetupWatch(test_file(), &watcher, delegate.get(), false));
619 619
620 // Now make sure we get notified if the file is modified. 620 // Now make sure we get notified if the file is modified.
621 ASSERT_TRUE(file_util::MakeFileUnreadable(test_file())); 621 ASSERT_TRUE(base::MakeFileUnreadable(test_file()));
622 ASSERT_TRUE(WaitForEvents()); 622 ASSERT_TRUE(WaitForEvents());
623 DeleteDelegateOnFileThread(delegate.release()); 623 DeleteDelegateOnFileThread(delegate.release());
624 } 624 }
625 625
626 #if defined(OS_LINUX) 626 #if defined(OS_LINUX)
627 627
628 // Verify that creating a symlink is caught. 628 // Verify that creating a symlink is caught.
629 TEST_F(FilePathWatcherTest, CreateLink) { 629 TEST_F(FilePathWatcherTest, CreateLink) {
630 FilePathWatcher watcher; 630 FilePathWatcher watcher;
631 scoped_ptr<TestDelegate> delegate(new TestDelegate(collector())); 631 scoped_ptr<TestDelegate> delegate(new TestDelegate(collector()));
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false)); 863 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, false));
864 ASSERT_TRUE(WaitForEvents()); 864 ASSERT_TRUE(WaitForEvents());
865 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true)); 865 ASSERT_TRUE(ChangeFilePermissions(test_dir1, Execute, true));
866 DeleteDelegateOnFileThread(delegate.release()); 866 DeleteDelegateOnFileThread(delegate.release());
867 } 867 }
868 868
869 #endif // OS_MACOSX 869 #endif // OS_MACOSX
870 } // namespace 870 } // namespace
871 871
872 } // namespace base 872 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util_unittest.cc ('k') | base/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698