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

Unified Diff: base/file_util_unittest.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util_posix.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_unittest.cc
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index cbe8f26ea0545bdc06dc6c29afc026ae3a74fe5a..7626957615a3f19ccf28864e94e01ee3823c966e 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -738,9 +738,9 @@ TEST_F(FileUtilTest, DeleteNonExistent) {
FilePath non_existent = temp_dir_.path().AppendASCII("bogus_file_dne.foobar");
ASSERT_FALSE(file_util::PathExists(non_existent));
- EXPECT_TRUE(file_util::Delete(non_existent, false));
+ EXPECT_TRUE(base::Delete(non_existent, false));
ASSERT_FALSE(file_util::PathExists(non_existent));
- EXPECT_TRUE(file_util::Delete(non_existent, true));
+ EXPECT_TRUE(base::Delete(non_existent, true));
ASSERT_FALSE(file_util::PathExists(non_existent));
}
@@ -751,7 +751,7 @@ TEST_F(FileUtilTest, DeleteFile) {
ASSERT_TRUE(file_util::PathExists(file_name));
// Make sure it's deleted
- EXPECT_TRUE(file_util::Delete(file_name, false));
+ EXPECT_TRUE(base::Delete(file_name, false));
EXPECT_FALSE(file_util::PathExists(file_name));
// Test recursive case, create a new file
@@ -760,7 +760,7 @@ TEST_F(FileUtilTest, DeleteFile) {
ASSERT_TRUE(file_util::PathExists(file_name));
// Make sure it's deleted
- EXPECT_TRUE(file_util::Delete(file_name, true));
+ EXPECT_TRUE(base::Delete(file_name, true));
EXPECT_FALSE(file_util::PathExists(file_name));
}
@@ -777,7 +777,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToExistentFile) {
<< "Failed to create symlink.";
// Delete the symbolic link.
- EXPECT_TRUE(file_util::Delete(file_link, false));
+ EXPECT_TRUE(base::Delete(file_link, false));
// Make sure original file is not deleted.
EXPECT_FALSE(file_util::PathExists(file_link));
@@ -799,7 +799,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) {
EXPECT_FALSE(file_util::PathExists(file_link));
// Delete the symbolic link.
- EXPECT_TRUE(file_util::Delete(file_link, false));
+ EXPECT_TRUE(base::Delete(file_link, false));
// Make sure the symbolic link is deleted.
EXPECT_FALSE(file_util::IsLink(file_link));
@@ -843,7 +843,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) {
file_util::ReadFile(file_name, buffer, buffer_size));
// Delete the file.
- EXPECT_TRUE(file_util::Delete(file_name, false));
+ EXPECT_TRUE(base::Delete(file_name, false));
EXPECT_FALSE(file_util::PathExists(file_name));
delete[] buffer;
@@ -888,7 +888,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) {
EXPECT_TRUE(file_util::PathIsWritable(file_name));
// Delete the file.
- EXPECT_TRUE(file_util::Delete(file_name, false));
+ EXPECT_TRUE(base::Delete(file_name, false));
EXPECT_FALSE(file_util::PathExists(file_name));
}
@@ -940,7 +940,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) {
EXPECT_EQ(c2.size(), 1);
// Delete the file.
- EXPECT_TRUE(file_util::Delete(subdir_path, true));
+ EXPECT_TRUE(base::Delete(subdir_path, true));
EXPECT_FALSE(file_util::PathExists(subdir_path));
}
@@ -965,12 +965,12 @@ TEST_F(FileUtilTest, DeleteWildCard) {
directory_contents = directory_contents.Append(FPL("*"));
// Delete non-recursively and check that only the file is deleted
- EXPECT_TRUE(file_util::Delete(directory_contents, false));
+ EXPECT_TRUE(base::Delete(directory_contents, false));
EXPECT_FALSE(file_util::PathExists(file_name));
EXPECT_TRUE(file_util::PathExists(subdir_path));
// Delete recursively and make sure all contents are deleted
- EXPECT_TRUE(file_util::Delete(directory_contents, true));
+ EXPECT_TRUE(base::Delete(directory_contents, true));
EXPECT_FALSE(file_util::PathExists(file_name));
EXPECT_FALSE(file_util::PathExists(subdir_path));
}
@@ -988,11 +988,11 @@ TEST_F(FileUtilTest, DeleteNonExistantWildCard) {
directory_contents = directory_contents.Append(FPL("*"));
// Delete non-recursively and check nothing got deleted
- EXPECT_TRUE(file_util::Delete(directory_contents, false));
+ EXPECT_TRUE(base::Delete(directory_contents, false));
EXPECT_TRUE(file_util::PathExists(subdir_path));
// Delete recursively and check nothing got deleted
- EXPECT_TRUE(file_util::Delete(directory_contents, true));
+ EXPECT_TRUE(base::Delete(directory_contents, true));
EXPECT_TRUE(file_util::PathExists(subdir_path));
}
#endif
@@ -1017,11 +1017,11 @@ TEST_F(FileUtilTest, DeleteDirNonRecursive) {
ASSERT_TRUE(file_util::PathExists(subdir_path2));
// Delete non-recursively and check that the empty dir got deleted
- EXPECT_TRUE(file_util::Delete(subdir_path2, false));
+ EXPECT_TRUE(base::Delete(subdir_path2, false));
EXPECT_FALSE(file_util::PathExists(subdir_path2));
// Delete non-recursively and check that nothing got deleted
- EXPECT_FALSE(file_util::Delete(test_subdir, false));
+ EXPECT_FALSE(base::Delete(test_subdir, false));
EXPECT_TRUE(file_util::PathExists(test_subdir));
EXPECT_TRUE(file_util::PathExists(file_name));
EXPECT_TRUE(file_util::PathExists(subdir_path1));
@@ -1047,11 +1047,11 @@ TEST_F(FileUtilTest, DeleteDirRecursive) {
ASSERT_TRUE(file_util::PathExists(subdir_path2));
// Delete recursively and check that the empty dir got deleted
- EXPECT_TRUE(file_util::Delete(subdir_path2, true));
+ EXPECT_TRUE(base::Delete(subdir_path2, true));
EXPECT_FALSE(file_util::PathExists(subdir_path2));
// Delete recursively and check that everything got deleted
- EXPECT_TRUE(file_util::Delete(test_subdir, true));
+ EXPECT_TRUE(base::Delete(test_subdir, true));
EXPECT_FALSE(file_util::PathExists(file_name));
EXPECT_FALSE(file_util::PathExists(subdir_path1));
EXPECT_FALSE(file_util::PathExists(test_subdir));
@@ -1695,7 +1695,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileTest) {
for (int i = 0; i < 3; i++)
EXPECT_FALSE(temp_files[i] == temp_files[(i+1)%3]);
for (int i = 0; i < 3; i++)
- EXPECT_TRUE(file_util::Delete(temp_files[i], false));
+ EXPECT_TRUE(base::Delete(temp_files[i], false));
}
TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) {
@@ -1718,7 +1718,7 @@ TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) {
// Close and delete.
for (i = 0; i < 3; ++i) {
EXPECT_TRUE(file_util::CloseFile(fps[i]));
- EXPECT_TRUE(file_util::Delete(names[i], false));
+ EXPECT_TRUE(base::Delete(names[i], false));
}
}
@@ -1727,7 +1727,7 @@ TEST_F(FileUtilTest, CreateNewTempDirectoryTest) {
ASSERT_TRUE(file_util::CreateNewTempDirectory(FilePath::StringType(),
&temp_dir));
EXPECT_TRUE(file_util::PathExists(temp_dir));
- EXPECT_TRUE(file_util::Delete(temp_dir, false));
+ EXPECT_TRUE(base::Delete(temp_dir, false));
}
TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) {
@@ -1738,7 +1738,7 @@ TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) {
&new_dir));
EXPECT_TRUE(file_util::PathExists(new_dir));
EXPECT_TRUE(temp_dir_.path().IsParent(new_dir));
- EXPECT_TRUE(file_util::Delete(new_dir, false));
+ EXPECT_TRUE(base::Delete(new_dir, false));
}
TEST_F(FileUtilTest, GetShmemTempDirTest) {
@@ -1771,7 +1771,7 @@ TEST_F(FileUtilTest, CreateDirectoryTest) {
EXPECT_TRUE(file_util::PathExists(test_path));
EXPECT_FALSE(file_util::CreateDirectory(test_path));
- EXPECT_TRUE(file_util::Delete(test_root, true));
+ EXPECT_TRUE(base::Delete(test_root, true));
EXPECT_FALSE(file_util::PathExists(test_root));
EXPECT_FALSE(file_util::PathExists(test_path));
@@ -1817,9 +1817,9 @@ TEST_F(FileUtilTest, DetectDirectoryTest) {
CreateTextFile(test_path, L"test file");
EXPECT_TRUE(file_util::PathExists(test_path));
EXPECT_FALSE(file_util::DirectoryExists(test_path));
- EXPECT_TRUE(file_util::Delete(test_path, false));
+ EXPECT_TRUE(base::Delete(test_path, false));
- EXPECT_TRUE(file_util::Delete(test_root, true));
+ EXPECT_TRUE(base::Delete(test_root, true));
}
TEST_F(FileUtilTest, FileEnumeratorTest) {
@@ -1937,13 +1937,13 @@ TEST_F(FileUtilTest, AppendToFile) {
// Create a fresh, empty copy of this directory.
if (file_util::PathExists(data_dir)) {
- ASSERT_TRUE(file_util::Delete(data_dir, true));
+ ASSERT_TRUE(base::Delete(data_dir, true));
}
ASSERT_TRUE(file_util::CreateDirectory(data_dir));
// Create a fresh, empty copy of this directory.
if (file_util::PathExists(data_dir)) {
- ASSERT_TRUE(file_util::Delete(data_dir, true));
+ ASSERT_TRUE(base::Delete(data_dir, true));
}
ASSERT_TRUE(file_util::CreateDirectory(data_dir));
FilePath foobar(data_dir.Append(FILE_PATH_LITERAL("foobar.txt")));
@@ -1965,7 +1965,7 @@ TEST_F(FileUtilTest, TouchFile) {
// Create a fresh, empty copy of this directory.
if (file_util::PathExists(data_dir)) {
- ASSERT_TRUE(file_util::Delete(data_dir, true));
+ ASSERT_TRUE(base::Delete(data_dir, true));
}
ASSERT_TRUE(file_util::CreateDirectory(data_dir));
« no previous file with comments | « base/file_util_posix.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698