Index: base/file_util_unittest.cc |
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc |
index 5cfc677ec95081bcd715ab586a5fe5f2e3c941a6..593ae8180ab7ad79e0c51e25b3c6cf63eda5ed8e 100644 |
--- a/base/file_util_unittest.cc |
+++ b/base/file_util_unittest.cc |
@@ -18,6 +18,7 @@ |
#include "base/base_paths.h" |
#include "base/file_util.h" |
+#include "base/files/file_enumerator.h" |
#include "base/files/file_path.h" |
#include "base/files/scoped_temp_dir.h" |
#include "base/path_service.h" |
@@ -34,6 +35,7 @@ |
// This macro helps avoid wrapped lines in the test structs. |
#define FPL(x) FILE_PATH_LITERAL(x) |
+using base::FileEnumerator; |
using base::FilePath; |
namespace { |
@@ -134,7 +136,7 @@ void ChangePosixFilePermissions(const FilePath& path, |
const wchar_t bogus_content[] = L"I'm cannon fodder."; |
const int FILES_AND_DIRECTORIES = |
- file_util::FileEnumerator::FILES | file_util::FileEnumerator::DIRECTORIES; |
+ FileEnumerator::FILES | FileEnumerator::DIRECTORIES; |
// file_util winds up using autoreleased objects on the Mac, so this needs |
// to be a PlatformTest |
@@ -152,7 +154,7 @@ class FileUtilTest : public PlatformTest { |
// interface to query whether a given file is present. |
class FindResultCollector { |
public: |
- explicit FindResultCollector(file_util::FileEnumerator& enumerator) { |
+ explicit FindResultCollector(FileEnumerator& enumerator) { |
FilePath cur_file; |
while (!(cur_file = enumerator.Next()).value().empty()) { |
FilePath::StringType path = cur_file.value(); |
@@ -917,8 +919,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { |
EXPECT_FALSE(mode & file_util::FILE_PERMISSION_USER_MASK); |
// Make sure the file in the directory can't be enumerated. |
- file_util::FileEnumerator f1(subdir_path, true, |
- file_util::FileEnumerator::FILES); |
+ FileEnumerator f1(subdir_path, true, FileEnumerator::FILES); |
EXPECT_TRUE(file_util::PathExists(subdir_path)); |
FindResultCollector c1(f1); |
EXPECT_EQ(c1.size(), 0); |
@@ -933,8 +934,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { |
mode & file_util::FILE_PERMISSION_USER_MASK); |
// Make sure the file in the directory can be enumerated. |
- file_util::FileEnumerator f2(subdir_path, true, |
- file_util::FileEnumerator::FILES); |
+ FileEnumerator f2(subdir_path, true, FileEnumerator::FILES); |
FindResultCollector c2(f2); |
EXPECT_TRUE(c2.HasFile(file_name)); |
EXPECT_EQ(c2.size(), 1); |
@@ -1824,13 +1824,13 @@ TEST_F(FileUtilTest, DetectDirectoryTest) { |
TEST_F(FileUtilTest, FileEnumeratorTest) { |
// Test an empty directory. |
- file_util::FileEnumerator f0(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
+ FileEnumerator f0(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
EXPECT_EQ(f0.Next().value(), FILE_PATH_LITERAL("")); |
EXPECT_EQ(f0.Next().value(), FILE_PATH_LITERAL("")); |
// Test an empty directory, non-recursively, including "..". |
- file_util::FileEnumerator f0_dotdot(temp_dir_.path(), false, |
- FILES_AND_DIRECTORIES | file_util::FileEnumerator::INCLUDE_DOT_DOT); |
+ FileEnumerator f0_dotdot(temp_dir_.path(), false, |
+ FILES_AND_DIRECTORIES | FileEnumerator::INCLUDE_DOT_DOT); |
EXPECT_EQ(temp_dir_.path().Append(FILE_PATH_LITERAL("..")).value(), |
f0_dotdot.Next().value()); |
EXPECT_EQ(FILE_PATH_LITERAL(""), |
@@ -1857,8 +1857,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
FilePath file2_abs = temp_dir_.path().Append(FILE_PATH_LITERAL("file2.txt")); |
// Only enumerate files. |
- file_util::FileEnumerator f1(temp_dir_.path(), true, |
- file_util::FileEnumerator::FILES); |
+ FileEnumerator f1(temp_dir_.path(), true, FileEnumerator::FILES); |
FindResultCollector c1(f1); |
EXPECT_TRUE(c1.HasFile(file1)); |
EXPECT_TRUE(c1.HasFile(file2_abs)); |
@@ -1867,8 +1866,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
EXPECT_EQ(c1.size(), 4); |
// Only enumerate directories. |
- file_util::FileEnumerator f2(temp_dir_.path(), true, |
- file_util::FileEnumerator::DIRECTORIES); |
+ FileEnumerator f2(temp_dir_.path(), true, FileEnumerator::DIRECTORIES); |
FindResultCollector c2(f2); |
EXPECT_TRUE(c2.HasFile(dir1)); |
EXPECT_TRUE(c2.HasFile(dir2)); |
@@ -1876,17 +1874,17 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
EXPECT_EQ(c2.size(), 3); |
// Only enumerate directories non-recursively. |
- file_util::FileEnumerator f2_non_recursive( |
- temp_dir_.path(), false, file_util::FileEnumerator::DIRECTORIES); |
+ FileEnumerator f2_non_recursive( |
+ temp_dir_.path(), false, FileEnumerator::DIRECTORIES); |
FindResultCollector c2_non_recursive(f2_non_recursive); |
EXPECT_TRUE(c2_non_recursive.HasFile(dir1)); |
EXPECT_TRUE(c2_non_recursive.HasFile(dir2)); |
EXPECT_EQ(c2_non_recursive.size(), 2); |
// Only enumerate directories, non-recursively, including "..". |
- file_util::FileEnumerator f2_dotdot(temp_dir_.path(), false, |
- file_util::FileEnumerator::DIRECTORIES | |
- file_util::FileEnumerator::INCLUDE_DOT_DOT); |
+ FileEnumerator f2_dotdot(temp_dir_.path(), false, |
+ FileEnumerator::DIRECTORIES | |
+ FileEnumerator::INCLUDE_DOT_DOT); |
FindResultCollector c2_dotdot(f2_dotdot); |
EXPECT_TRUE(c2_dotdot.HasFile(dir1)); |
EXPECT_TRUE(c2_dotdot.HasFile(dir2)); |
@@ -1895,7 +1893,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
EXPECT_EQ(c2_dotdot.size(), 3); |
// Enumerate files and directories. |
- file_util::FileEnumerator f3(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
+ FileEnumerator f3(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
FindResultCollector c3(f3); |
EXPECT_TRUE(c3.HasFile(dir1)); |
EXPECT_TRUE(c3.HasFile(dir2)); |
@@ -1907,7 +1905,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
EXPECT_EQ(c3.size(), 7); |
// Non-recursive operation. |
- file_util::FileEnumerator f4(temp_dir_.path(), false, FILES_AND_DIRECTORIES); |
+ FileEnumerator f4(temp_dir_.path(), false, FILES_AND_DIRECTORIES); |
FindResultCollector c4(f4); |
EXPECT_TRUE(c4.HasFile(dir2)); |
EXPECT_TRUE(c4.HasFile(dir2)); |
@@ -1916,7 +1914,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
EXPECT_EQ(c4.size(), 4); |
// Enumerate with a pattern. |
- file_util::FileEnumerator f5(temp_dir_.path(), true, FILES_AND_DIRECTORIES, |
+ FileEnumerator f5(temp_dir_.path(), true, FILES_AND_DIRECTORIES, |
FILE_PATH_LITERAL("dir*")); |
FindResultCollector c5(f5); |
EXPECT_TRUE(c5.HasFile(dir1)); |
@@ -1928,7 +1926,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) { |
// Make sure the destructor closes the find handle while in the middle of a |
// query to allow TearDown to delete the directory. |
- file_util::FileEnumerator f6(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
+ FileEnumerator f6(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
EXPECT_FALSE(f6.Next().value().empty()); // Should have found something |
// (we don't care what). |
} |