| Index: base/files/file_util_unittest.cc
|
| diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc
|
| index 153cd9cbd49122d9b328a95ea527cda0bd6858d0..f189ce296ce27a723fc5950f25d48ec827acd74d 100644
|
| --- a/base/files/file_util_unittest.cc
|
| +++ b/base/files/file_util_unittest.cc
|
| @@ -249,13 +249,13 @@ std::wstring ReadTextFile(const FilePath& filename) {
|
| TEST_F(FileUtilTest, FileAndDirectorySize) {
|
| // Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize
|
| // should return 53 bytes.
|
| - FilePath file_01 = temp_dir_.path().Append(FPL("The file 01.txt"));
|
| + FilePath file_01 = temp_dir_.GetPath().Append(FPL("The file 01.txt"));
|
| CreateTextFile(file_01, L"12345678901234567890");
|
| int64_t size_f1 = 0;
|
| ASSERT_TRUE(GetFileSize(file_01, &size_f1));
|
| EXPECT_EQ(20ll, size_f1);
|
|
|
| - FilePath subdir_path = temp_dir_.path().Append(FPL("Level2"));
|
| + FilePath subdir_path = temp_dir_.GetPath().Append(FPL("Level2"));
|
| CreateDirectory(subdir_path);
|
|
|
| FilePath file_02 = subdir_path.Append(FPL("The file 02.txt"));
|
| @@ -270,15 +270,15 @@ TEST_F(FileUtilTest, FileAndDirectorySize) {
|
| FilePath file_03 = subsubdir_path.Append(FPL("The file 03.txt"));
|
| CreateTextFile(file_03, L"123");
|
|
|
| - int64_t computed_size = ComputeDirectorySize(temp_dir_.path());
|
| + int64_t computed_size = ComputeDirectorySize(temp_dir_.GetPath());
|
| EXPECT_EQ(size_f1 + size_f2 + 3, computed_size);
|
| }
|
|
|
| TEST_F(FileUtilTest, NormalizeFilePathBasic) {
|
| // Create a directory under the test dir. Because we create it,
|
| // we know it is not a link.
|
| - FilePath file_a_path = temp_dir_.path().Append(FPL("file_a"));
|
| - FilePath dir_path = temp_dir_.path().Append(FPL("dir"));
|
| + FilePath file_a_path = temp_dir_.GetPath().Append(FPL("file_a"));
|
| + FilePath dir_path = temp_dir_.GetPath().Append(FPL("dir"));
|
| FilePath file_b_path = dir_path.Append(FPL("file_b"));
|
| CreateDirectory(dir_path);
|
|
|
| @@ -319,7 +319,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
|
| // |-> to_base_b (reparse point to temp_dir\base_b)
|
| // |-> to_sub_long (reparse point to temp_dir\sub_a\long_name_\sub_long)
|
|
|
| - FilePath base_a = temp_dir_.path().Append(FPL("base_a"));
|
| + FilePath base_a = temp_dir_.GetPath().Append(FPL("base_a"));
|
| #if defined(OS_WIN)
|
| // TEMP can have a lower case drive letter.
|
| string16 temp_base_a = base_a.value();
|
| @@ -362,7 +362,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
|
| ASSERT_TRUE(CreateDirectory(sub_long));
|
| CreateTextFile(deep_file, bogus_content);
|
|
|
| - FilePath base_b = temp_dir_.path().Append(FPL("base_b"));
|
| + FilePath base_b = temp_dir_.GetPath().Append(FPL("base_b"));
|
| ASSERT_TRUE(CreateDirectory(base_b));
|
|
|
| FilePath to_sub_a = base_b.Append(FPL("to_sub_a"));
|
| @@ -430,7 +430,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
|
| TEST_F(FileUtilTest, DevicePathToDriveLetter) {
|
| // Get a drive letter.
|
| string16 real_drive_letter =
|
| - ToUpperASCII(temp_dir_.path().value().substr(0, 2));
|
| + ToUpperASCII(temp_dir_.GetPath().value().substr(0, 2));
|
| if (!isalpha(real_drive_letter[0]) || ':' != real_drive_letter[1]) {
|
| LOG(ERROR) << "Can't get a drive letter to test with.";
|
| return;
|
| @@ -504,7 +504,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileInDirLongPathTest) {
|
| // directories of |temp_dir_|.
|
| const FilePath::CharType kLongDirName[] = FPL("A long path");
|
| const FilePath::CharType kTestSubDirName[] = FPL("test");
|
| - FilePath long_test_dir = temp_dir_.path().Append(kLongDirName);
|
| + FilePath long_test_dir = temp_dir_.GetPath().Append(kLongDirName);
|
| ASSERT_TRUE(CreateDirectory(long_test_dir));
|
|
|
| // kLongDirName is not a 8.3 component. So GetShortName() should give us a
|
| @@ -551,8 +551,8 @@ TEST_F(FileUtilTest, CreateTemporaryFileInDirLongPathTest) {
|
| #if defined(OS_POSIX)
|
|
|
| TEST_F(FileUtilTest, CreateAndReadSymlinks) {
|
| - FilePath link_from = temp_dir_.path().Append(FPL("from_file"));
|
| - FilePath link_to = temp_dir_.path().Append(FPL("to_file"));
|
| + FilePath link_from = temp_dir_.GetPath().Append(FPL("from_file"));
|
| + FilePath link_to = temp_dir_.GetPath().Append(FPL("to_file"));
|
| CreateTextFile(link_to, bogus_content);
|
|
|
| ASSERT_TRUE(CreateSymbolicLink(link_to, link_from))
|
| @@ -568,8 +568,8 @@ TEST_F(FileUtilTest, CreateAndReadSymlinks) {
|
| EXPECT_EQ(link_to.value(), result.value());
|
|
|
| // Link to a directory.
|
| - link_from = temp_dir_.path().Append(FPL("from_dir"));
|
| - link_to = temp_dir_.path().Append(FPL("to_dir"));
|
| + link_from = temp_dir_.GetPath().Append(FPL("from_dir"));
|
| + link_to = temp_dir_.GetPath().Append(FPL("to_dir"));
|
| ASSERT_TRUE(CreateDirectory(link_to));
|
| ASSERT_TRUE(CreateSymbolicLink(link_to, link_from))
|
| << "Failed to create directory symlink.";
|
| @@ -577,7 +577,7 @@ TEST_F(FileUtilTest, CreateAndReadSymlinks) {
|
| // Test failures.
|
| EXPECT_FALSE(CreateSymbolicLink(link_to, link_to));
|
| EXPECT_FALSE(ReadSymbolicLink(link_to, &result));
|
| - FilePath missing = temp_dir_.path().Append(FPL("missing"));
|
| + FilePath missing = temp_dir_.GetPath().Append(FPL("missing"));
|
| EXPECT_FALSE(ReadSymbolicLink(missing, &result));
|
| }
|
|
|
| @@ -588,8 +588,8 @@ TEST_F(FileUtilTest, CreateAndReadSymlinks) {
|
| // privileges required to create a symlink.
|
| TEST_F(FileUtilTest, NormalizeFilePathSymlinks) {
|
| // Link one file to another.
|
| - FilePath link_from = temp_dir_.path().Append(FPL("from_file"));
|
| - FilePath link_to = temp_dir_.path().Append(FPL("to_file"));
|
| + FilePath link_from = temp_dir_.GetPath().Append(FPL("from_file"));
|
| + FilePath link_to = temp_dir_.GetPath().Append(FPL("to_file"));
|
| CreateTextFile(link_to, bogus_content);
|
|
|
| ASSERT_TRUE(CreateSymbolicLink(link_to, link_from))
|
| @@ -603,8 +603,8 @@ TEST_F(FileUtilTest, NormalizeFilePathSymlinks) {
|
| EXPECT_EQ(link_to.BaseName().value(), normalized_path.BaseName().value());
|
|
|
| // Link to a directory.
|
| - link_from = temp_dir_.path().Append(FPL("from_dir"));
|
| - link_to = temp_dir_.path().Append(FPL("to_dir"));
|
| + link_from = temp_dir_.GetPath().Append(FPL("from_dir"));
|
| + link_to = temp_dir_.GetPath().Append(FPL("to_dir"));
|
| ASSERT_TRUE(CreateDirectory(link_to));
|
| ASSERT_TRUE(CreateSymbolicLink(link_to, link_from))
|
| << "Failed to create directory symlink.";
|
| @@ -613,8 +613,8 @@ TEST_F(FileUtilTest, NormalizeFilePathSymlinks) {
|
| << "Links to directories should return false.";
|
|
|
| // Test that a loop in the links causes NormalizeFilePath() to return false.
|
| - link_from = temp_dir_.path().Append(FPL("link_a"));
|
| - link_to = temp_dir_.path().Append(FPL("link_b"));
|
| + link_from = temp_dir_.GetPath().Append(FPL("link_a"));
|
| + link_to = temp_dir_.GetPath().Append(FPL("link_b"));
|
| ASSERT_TRUE(CreateSymbolicLink(link_to, link_from))
|
| << "Failed to create loop symlink a.";
|
| ASSERT_TRUE(CreateSymbolicLink(link_from, link_to))
|
| @@ -626,7 +626,8 @@ TEST_F(FileUtilTest, NormalizeFilePathSymlinks) {
|
| #endif // defined(OS_POSIX)
|
|
|
| TEST_F(FileUtilTest, DeleteNonExistent) {
|
| - FilePath non_existent = temp_dir_.path().AppendASCII("bogus_file_dne.foobar");
|
| + FilePath non_existent =
|
| + temp_dir_.GetPath().AppendASCII("bogus_file_dne.foobar");
|
| ASSERT_FALSE(PathExists(non_existent));
|
|
|
| EXPECT_TRUE(DeleteFile(non_existent, false));
|
| @@ -636,7 +637,7 @@ TEST_F(FileUtilTest, DeleteNonExistent) {
|
| }
|
|
|
| TEST_F(FileUtilTest, DeleteNonExistentWithNonExistentParent) {
|
| - FilePath non_existent = temp_dir_.path().AppendASCII("bogus_topdir");
|
| + FilePath non_existent = temp_dir_.GetPath().AppendASCII("bogus_topdir");
|
| non_existent = non_existent.AppendASCII("bogus_subdir");
|
| ASSERT_FALSE(PathExists(non_existent));
|
|
|
| @@ -648,7 +649,7 @@ TEST_F(FileUtilTest, DeleteNonExistentWithNonExistentParent) {
|
|
|
| TEST_F(FileUtilTest, DeleteFile) {
|
| // Create a file
|
| - FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteFile 1.txt"));
|
| + FilePath file_name = temp_dir_.GetPath().Append(FPL("Test DeleteFile 1.txt"));
|
| CreateTextFile(file_name, bogus_content);
|
| ASSERT_TRUE(PathExists(file_name));
|
|
|
| @@ -657,7 +658,7 @@ TEST_F(FileUtilTest, DeleteFile) {
|
| EXPECT_FALSE(PathExists(file_name));
|
|
|
| // Test recursive case, create a new file
|
| - file_name = temp_dir_.path().Append(FPL("Test DeleteFile 2.txt"));
|
| + file_name = temp_dir_.GetPath().Append(FPL("Test DeleteFile 2.txt"));
|
| CreateTextFile(file_name, bogus_content);
|
| ASSERT_TRUE(PathExists(file_name));
|
|
|
| @@ -669,12 +670,12 @@ TEST_F(FileUtilTest, DeleteFile) {
|
| #if defined(OS_POSIX)
|
| TEST_F(FileUtilTest, DeleteSymlinkToExistentFile) {
|
| // Create a file.
|
| - FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteFile 2.txt"));
|
| + FilePath file_name = temp_dir_.GetPath().Append(FPL("Test DeleteFile 2.txt"));
|
| CreateTextFile(file_name, bogus_content);
|
| ASSERT_TRUE(PathExists(file_name));
|
|
|
| // Create a symlink to the file.
|
| - FilePath file_link = temp_dir_.path().Append("file_link_2");
|
| + FilePath file_link = temp_dir_.GetPath().Append("file_link_2");
|
| ASSERT_TRUE(CreateSymbolicLink(file_name, file_link))
|
| << "Failed to create symlink.";
|
|
|
| @@ -688,11 +689,12 @@ TEST_F(FileUtilTest, DeleteSymlinkToExistentFile) {
|
|
|
| TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) {
|
| // Create a non-existent file path.
|
| - FilePath non_existent = temp_dir_.path().Append(FPL("Test DeleteFile 3.txt"));
|
| + FilePath non_existent =
|
| + temp_dir_.GetPath().Append(FPL("Test DeleteFile 3.txt"));
|
| EXPECT_FALSE(PathExists(non_existent));
|
|
|
| // Create a symlink to the non-existent file.
|
| - FilePath file_link = temp_dir_.path().Append("file_link_3");
|
| + FilePath file_link = temp_dir_.GetPath().Append("file_link_3");
|
| ASSERT_TRUE(CreateSymbolicLink(non_existent, file_link))
|
| << "Failed to create symlink.";
|
|
|
| @@ -709,7 +711,8 @@ TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) {
|
|
|
| TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) {
|
| // Create a file path.
|
| - FilePath file_name = temp_dir_.path().Append(FPL("Test Readable File.txt"));
|
| + FilePath file_name =
|
| + temp_dir_.GetPath().Append(FPL("Test Readable File.txt"));
|
| EXPECT_FALSE(PathExists(file_name));
|
|
|
| const std::string kData("hello");
|
| @@ -751,7 +754,8 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) {
|
|
|
| TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) {
|
| // Create a file path.
|
| - FilePath file_name = temp_dir_.path().Append(FPL("Test Readable File.txt"));
|
| + FilePath file_name =
|
| + temp_dir_.GetPath().Append(FPL("Test Readable File.txt"));
|
| EXPECT_FALSE(PathExists(file_name));
|
|
|
| const std::string kData("hello");
|
| @@ -792,8 +796,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) {
|
|
|
| TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) {
|
| // Create a directory path.
|
| - FilePath subdir_path =
|
| - temp_dir_.path().Append(FPL("PermissionTest1"));
|
| + FilePath subdir_path = temp_dir_.GetPath().Append(FPL("PermissionTest1"));
|
| CreateDirectory(subdir_path);
|
| ASSERT_TRUE(PathExists(subdir_path));
|
|
|
| @@ -844,8 +847,8 @@ TEST_F(FileUtilTest, ExecutableExistsInPath) {
|
| const FilePath::CharType kDir1[] = FPL("dir1");
|
| const FilePath::CharType kDir2[] = FPL("dir2");
|
|
|
| - FilePath dir1 = temp_dir_.path().Append(kDir1);
|
| - FilePath dir2 = temp_dir_.path().Append(kDir2);
|
| + FilePath dir1 = temp_dir_.GetPath().Append(kDir1);
|
| + FilePath dir2 = temp_dir_.GetPath().Append(kDir2);
|
| ASSERT_TRUE(CreateDirectory(dir1));
|
| ASSERT_TRUE(CreateDirectory(dir2));
|
|
|
| @@ -885,16 +888,17 @@ TEST_F(FileUtilTest, ExecutableExistsInPath) {
|
| // TODO(erikkay): see if anyone's actually using this feature of the API
|
| TEST_F(FileUtilTest, DeleteWildCard) {
|
| // Create a file and a directory
|
| - FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteWildCard.txt"));
|
| + FilePath file_name =
|
| + temp_dir_.GetPath().Append(FPL("Test DeleteWildCard.txt"));
|
| CreateTextFile(file_name, bogus_content);
|
| ASSERT_TRUE(PathExists(file_name));
|
|
|
| - FilePath subdir_path = temp_dir_.path().Append(FPL("DeleteWildCardDir"));
|
| + FilePath subdir_path = temp_dir_.GetPath().Append(FPL("DeleteWildCardDir"));
|
| CreateDirectory(subdir_path);
|
| ASSERT_TRUE(PathExists(subdir_path));
|
|
|
| // Create the wildcard path
|
| - FilePath directory_contents = temp_dir_.path();
|
| + FilePath directory_contents = temp_dir_.GetPath();
|
| directory_contents = directory_contents.Append(FPL("*"));
|
|
|
| // Delete non-recursively and check that only the file is deleted
|
| @@ -912,7 +916,7 @@ TEST_F(FileUtilTest, DeleteWildCard) {
|
| TEST_F(FileUtilTest, DeleteNonExistantWildCard) {
|
| // Create a file and a directory
|
| FilePath subdir_path =
|
| - temp_dir_.path().Append(FPL("DeleteNonExistantWildCard"));
|
| + temp_dir_.GetPath().Append(FPL("DeleteNonExistantWildCard"));
|
| CreateDirectory(subdir_path);
|
| ASSERT_TRUE(PathExists(subdir_path));
|
|
|
| @@ -933,7 +937,8 @@ TEST_F(FileUtilTest, DeleteNonExistantWildCard) {
|
| // Tests non-recursive Delete() for a directory.
|
| TEST_F(FileUtilTest, DeleteDirNonRecursive) {
|
| // Create a subdirectory and put a file and two directories inside.
|
| - FilePath test_subdir = temp_dir_.path().Append(FPL("DeleteDirNonRecursive"));
|
| + FilePath test_subdir =
|
| + temp_dir_.GetPath().Append(FPL("DeleteDirNonRecursive"));
|
| CreateDirectory(test_subdir);
|
| ASSERT_TRUE(PathExists(test_subdir));
|
|
|
| @@ -963,7 +968,7 @@ TEST_F(FileUtilTest, DeleteDirNonRecursive) {
|
| // Tests recursive Delete() for a directory.
|
| TEST_F(FileUtilTest, DeleteDirRecursive) {
|
| // Create a subdirectory and put a file and two directories inside.
|
| - FilePath test_subdir = temp_dir_.path().Append(FPL("DeleteDirRecursive"));
|
| + FilePath test_subdir = temp_dir_.GetPath().Append(FPL("DeleteDirRecursive"));
|
| CreateDirectory(test_subdir);
|
| ASSERT_TRUE(PathExists(test_subdir));
|
|
|
| @@ -993,12 +998,12 @@ TEST_F(FileUtilTest, DeleteDirRecursive) {
|
| TEST_F(FileUtilTest, MoveFileNew) {
|
| // Create a file
|
| FilePath file_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
| CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // The destination.
|
| - FilePath file_name_to = temp_dir_.path().Append(
|
| + FilePath file_name_to = temp_dir_.GetPath().Append(
|
| FILE_PATH_LITERAL("Move_Test_File_Destination.txt"));
|
| ASSERT_FALSE(PathExists(file_name_to));
|
|
|
| @@ -1012,12 +1017,12 @@ TEST_F(FileUtilTest, MoveFileNew) {
|
| TEST_F(FileUtilTest, MoveFileExists) {
|
| // Create a file
|
| FilePath file_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
| CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // The destination name.
|
| - FilePath file_name_to = temp_dir_.path().Append(
|
| + FilePath file_name_to = temp_dir_.GetPath().Append(
|
| FILE_PATH_LITERAL("Move_Test_File_Destination.txt"));
|
| CreateTextFile(file_name_to, L"Old file content");
|
| ASSERT_TRUE(PathExists(file_name_to));
|
| @@ -1033,13 +1038,13 @@ TEST_F(FileUtilTest, MoveFileExists) {
|
| TEST_F(FileUtilTest, MoveFileDirExists) {
|
| // Create a file
|
| FilePath file_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
| CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // The destination directory
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Destination"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Destination"));
|
| CreateDirectory(dir_name_to);
|
| ASSERT_TRUE(PathExists(dir_name_to));
|
|
|
| @@ -1050,7 +1055,7 @@ TEST_F(FileUtilTest, MoveFileDirExists) {
|
| TEST_F(FileUtilTest, MoveNew) {
|
| // Create a directory
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Move_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Move_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1062,7 +1067,7 @@ TEST_F(FileUtilTest, MoveNew) {
|
|
|
| // Move the directory.
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Move_To_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Move_To_Subdir"));
|
| FilePath file_name_to =
|
| dir_name_to.Append(FILE_PATH_LITERAL("Move_Test_File.txt"));
|
|
|
| @@ -1091,7 +1096,7 @@ TEST_F(FileUtilTest, MoveNew) {
|
| TEST_F(FileUtilTest, MoveExist) {
|
| // Create a directory
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Move_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Move_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1103,7 +1108,7 @@ TEST_F(FileUtilTest, MoveExist) {
|
|
|
| // Move the directory
|
| FilePath dir_name_exists =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Destination"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Destination"));
|
|
|
| FilePath dir_name_to =
|
| dir_name_exists.Append(FILE_PATH_LITERAL("Move_To_Subdir"));
|
| @@ -1126,7 +1131,7 @@ TEST_F(FileUtilTest, MoveExist) {
|
| TEST_F(FileUtilTest, CopyDirectoryRecursivelyNew) {
|
| // Create a directory.
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1150,7 +1155,7 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyNew) {
|
|
|
| // Copy the directory recursively.
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| FilePath file_name_to =
|
| dir_name_to.Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| FilePath subdir_name_to =
|
| @@ -1176,7 +1181,7 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyNew) {
|
| TEST_F(FileUtilTest, CopyDirectoryRecursivelyExists) {
|
| // Create a directory.
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1200,7 +1205,7 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyExists) {
|
|
|
| // Copy the directory recursively.
|
| FilePath dir_name_exists =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Destination"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Destination"));
|
|
|
| FilePath dir_name_to =
|
| dir_name_exists.Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| @@ -1231,7 +1236,7 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyExists) {
|
| TEST_F(FileUtilTest, CopyDirectoryNew) {
|
| // Create a directory.
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1255,7 +1260,7 @@ TEST_F(FileUtilTest, CopyDirectoryNew) {
|
|
|
| // Copy the directory not recursively.
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| FilePath file_name_to =
|
| dir_name_to.Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| FilePath subdir_name_to =
|
| @@ -1278,7 +1283,7 @@ TEST_F(FileUtilTest, CopyDirectoryNew) {
|
| TEST_F(FileUtilTest, CopyDirectoryExists) {
|
| // Create a directory.
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1302,7 +1307,7 @@ TEST_F(FileUtilTest, CopyDirectoryExists) {
|
|
|
| // Copy the directory not recursively.
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| FilePath file_name_to =
|
| dir_name_to.Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| FilePath subdir_name_to =
|
| @@ -1327,12 +1332,12 @@ TEST_F(FileUtilTest, CopyDirectoryExists) {
|
| TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToNew) {
|
| // Create a file
|
| FilePath file_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // The destination name
|
| - FilePath file_name_to = temp_dir_.path().Append(
|
| + FilePath file_name_to = temp_dir_.GetPath().Append(
|
| FILE_PATH_LITERAL("Copy_Test_File_Destination.txt"));
|
| ASSERT_FALSE(PathExists(file_name_to));
|
|
|
| @@ -1345,12 +1350,12 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToNew) {
|
| TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExisting) {
|
| // Create a file
|
| FilePath file_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // The destination name
|
| - FilePath file_name_to = temp_dir_.path().Append(
|
| + FilePath file_name_to = temp_dir_.GetPath().Append(
|
| FILE_PATH_LITERAL("Copy_Test_File_Destination.txt"));
|
| CreateTextFile(file_name_to, L"Old file content");
|
| ASSERT_TRUE(PathExists(file_name_to));
|
| @@ -1365,13 +1370,13 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExisting) {
|
| TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExistingDirectory) {
|
| // Create a file
|
| FilePath file_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // The destination
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Destination"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Destination"));
|
| CreateDirectory(dir_name_to);
|
| ASSERT_TRUE(PathExists(dir_name_to));
|
| FilePath file_name_to =
|
| @@ -1386,7 +1391,7 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExistingDirectory) {
|
| TEST_F(FileUtilTest, CopyDirectoryWithTrailingSeparators) {
|
| // Create a directory.
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1398,17 +1403,17 @@ TEST_F(FileUtilTest, CopyDirectoryWithTrailingSeparators) {
|
|
|
| // Copy the directory recursively.
|
| FilePath dir_name_to =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_To_Subdir"));
|
| FilePath file_name_to =
|
| dir_name_to.Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
|
|
| // Create from path with trailing separators.
|
| #if defined(OS_WIN)
|
| FilePath from_path =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir\\\\\\"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir\\\\\\"));
|
| #elif defined(OS_POSIX)
|
| FilePath from_path =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir///"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir///"));
|
| #endif
|
|
|
| EXPECT_TRUE(CopyDirectory(from_path, dir_name_to, true));
|
| @@ -1462,7 +1467,7 @@ bool IsReadOnly(const FilePath& path) {
|
|
|
| TEST_F(FileUtilTest, CopyDirectoryACL) {
|
| // Create source directories.
|
| - FilePath src = temp_dir_.path().Append(FILE_PATH_LITERAL("src"));
|
| + FilePath src = temp_dir_.GetPath().Append(FILE_PATH_LITERAL("src"));
|
| FilePath src_subdir = src.Append(FILE_PATH_LITERAL("subdir"));
|
| CreateDirectory(src_subdir);
|
| ASSERT_TRUE(PathExists(src_subdir));
|
| @@ -1478,7 +1483,7 @@ TEST_F(FileUtilTest, CopyDirectoryACL) {
|
| ASSERT_TRUE(IsReadOnly(src_subdir));
|
|
|
| // Copy the directory recursively.
|
| - FilePath dst = temp_dir_.path().Append(FILE_PATH_LITERAL("dst"));
|
| + FilePath dst = temp_dir_.GetPath().Append(FILE_PATH_LITERAL("dst"));
|
| FilePath dst_file = dst.Append(FILE_PATH_LITERAL("src.txt"));
|
| EXPECT_TRUE(CopyDirectory(src, dst, true));
|
|
|
| @@ -1494,7 +1499,7 @@ TEST_F(FileUtilTest, CopyDirectoryACL) {
|
| TEST_F(FileUtilTest, CopyFile) {
|
| // Create a directory
|
| FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1532,7 +1537,7 @@ TEST_F(FileUtilTest, CopyFileACL) {
|
| // While FileUtilTest.CopyFile asserts the content is correctly copied over,
|
| // this test case asserts the access control bits are meeting expectations in
|
| // CopyFile().
|
| - FilePath src = temp_dir_.path().Append(FILE_PATH_LITERAL("src.txt"));
|
| + FilePath src = temp_dir_.GetPath().Append(FILE_PATH_LITERAL("src.txt"));
|
| const std::wstring file_contents(L"Gooooooooooooooooooooogle");
|
| CreateTextFile(src, file_contents);
|
|
|
| @@ -1542,7 +1547,7 @@ TEST_F(FileUtilTest, CopyFileACL) {
|
| ASSERT_TRUE(IsReadOnly(src));
|
|
|
| // Copy the file.
|
| - FilePath dst = temp_dir_.path().Append(FILE_PATH_LITERAL("dst.txt"));
|
| + FilePath dst = temp_dir_.GetPath().Append(FILE_PATH_LITERAL("dst.txt"));
|
| ASSERT_TRUE(CopyFile(src, dst));
|
| EXPECT_EQ(file_contents, ReadTextFile(dst));
|
|
|
| @@ -1648,8 +1653,8 @@ TEST_F(ReadOnlyFileUtilTest, TextContentsEqual) {
|
| #if defined(OS_WIN)
|
| TEST_F(FileUtilTest, CopyAndDeleteDirectoryTest) {
|
| // Create a directory
|
| - FilePath dir_name_from =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("CopyAndDelete_From_Subdir"));
|
| + FilePath dir_name_from = temp_dir_.GetPath().Append(
|
| + FILE_PATH_LITERAL("CopyAndDelete_From_Subdir"));
|
| CreateDirectory(dir_name_from);
|
| ASSERT_TRUE(PathExists(dir_name_from));
|
|
|
| @@ -1660,8 +1665,8 @@ TEST_F(FileUtilTest, CopyAndDeleteDirectoryTest) {
|
| ASSERT_TRUE(PathExists(file_name_from));
|
|
|
| // Move the directory by using CopyAndDeleteDirectory
|
| - FilePath dir_name_to = temp_dir_.path().Append(
|
| - FILE_PATH_LITERAL("CopyAndDelete_To_Subdir"));
|
| + FilePath dir_name_to =
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("CopyAndDelete_To_Subdir"));
|
| FilePath file_name_to =
|
| dir_name_to.Append(FILE_PATH_LITERAL("CopyAndDelete_Test_File.txt"));
|
|
|
| @@ -1803,7 +1808,7 @@ TEST_F(FileUtilTest, FileToFILE) {
|
| FILE* stream = FileToFILE(std::move(file), "w");
|
| EXPECT_FALSE(stream);
|
|
|
| - FilePath file_name = temp_dir_.path().Append(FPL("The file.txt"));
|
| + FilePath file_name = temp_dir_.GetPath().Append(FPL("The file.txt"));
|
| file = File(file_name, File::FLAG_CREATE | File::FLAG_WRITE);
|
| EXPECT_TRUE(file.IsValid());
|
|
|
| @@ -1823,11 +1828,10 @@ TEST_F(FileUtilTest, CreateNewTempDirectoryTest) {
|
| TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) {
|
| FilePath new_dir;
|
| ASSERT_TRUE(CreateTemporaryDirInDir(
|
| - temp_dir_.path(),
|
| - FILE_PATH_LITERAL("CreateNewTemporaryDirInDirTest"),
|
| - &new_dir));
|
| + temp_dir_.GetPath(), FILE_PATH_LITERAL("CreateNewTemporaryDirInDirTest"),
|
| + &new_dir));
|
| EXPECT_TRUE(PathExists(new_dir));
|
| - EXPECT_TRUE(temp_dir_.path().IsParent(new_dir));
|
| + EXPECT_TRUE(temp_dir_.GetPath().IsParent(new_dir));
|
| EXPECT_TRUE(DeleteFile(new_dir, false));
|
| }
|
|
|
| @@ -1852,7 +1856,7 @@ TEST_F(FileUtilTest, GetHomeDirTest) {
|
|
|
| TEST_F(FileUtilTest, CreateDirectoryTest) {
|
| FilePath test_root =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("create_directory_test"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("create_directory_test"));
|
| #if defined(OS_WIN)
|
| FilePath test_path =
|
| test_root.Append(FILE_PATH_LITERAL("dir\\tree\\likely\\doesnt\\exist\\"));
|
| @@ -1907,7 +1911,7 @@ TEST_F(FileUtilTest, CreateDirectoryTest) {
|
| TEST_F(FileUtilTest, DetectDirectoryTest) {
|
| // Check a directory
|
| FilePath test_root =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("detect_directory_test"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("detect_directory_test"));
|
| EXPECT_FALSE(PathExists(test_root));
|
| EXPECT_TRUE(CreateDirectory(test_root));
|
| EXPECT_TRUE(PathExists(test_root));
|
| @@ -1926,21 +1930,22 @@ TEST_F(FileUtilTest, DetectDirectoryTest) {
|
|
|
| TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| // Test an empty directory.
|
| - FileEnumerator f0(temp_dir_.path(), true, FILES_AND_DIRECTORIES);
|
| + FileEnumerator f0(temp_dir_.GetPath(), true, FILES_AND_DIRECTORIES);
|
| EXPECT_EQ(FPL(""), f0.Next().value());
|
| EXPECT_EQ(FPL(""), f0.Next().value());
|
|
|
| // Test an empty directory, non-recursively, including "..".
|
| - FileEnumerator f0_dotdot(temp_dir_.path(), false,
|
| + FileEnumerator f0_dotdot(
|
| + temp_dir_.GetPath(), false,
|
| FILES_AND_DIRECTORIES | FileEnumerator::INCLUDE_DOT_DOT);
|
| - EXPECT_EQ(temp_dir_.path().Append(FPL("..")).value(),
|
| + EXPECT_EQ(temp_dir_.GetPath().Append(FPL("..")).value(),
|
| f0_dotdot.Next().value());
|
| EXPECT_EQ(FPL(""), f0_dotdot.Next().value());
|
|
|
| // create the directories
|
| - FilePath dir1 = temp_dir_.path().Append(FPL("dir1"));
|
| + FilePath dir1 = temp_dir_.GetPath().Append(FPL("dir1"));
|
| EXPECT_TRUE(CreateDirectory(dir1));
|
| - FilePath dir2 = temp_dir_.path().Append(FPL("dir2"));
|
| + FilePath dir2 = temp_dir_.GetPath().Append(FPL("dir2"));
|
| EXPECT_TRUE(CreateDirectory(dir2));
|
| FilePath dir2inner = dir2.Append(FPL("inner"));
|
| EXPECT_TRUE(CreateDirectory(dir2inner));
|
| @@ -1950,15 +1955,15 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| CreateTextFile(dir2file, std::wstring());
|
| FilePath dir2innerfile = dir2inner.Append(FPL("innerfile.txt"));
|
| CreateTextFile(dir2innerfile, std::wstring());
|
| - FilePath file1 = temp_dir_.path().Append(FPL("file1.txt"));
|
| + FilePath file1 = temp_dir_.GetPath().Append(FPL("file1.txt"));
|
| CreateTextFile(file1, std::wstring());
|
| FilePath file2_rel = dir2.Append(FilePath::kParentDirectory)
|
| .Append(FPL("file2.txt"));
|
| CreateTextFile(file2_rel, std::wstring());
|
| - FilePath file2_abs = temp_dir_.path().Append(FPL("file2.txt"));
|
| + FilePath file2_abs = temp_dir_.GetPath().Append(FPL("file2.txt"));
|
|
|
| // Only enumerate files.
|
| - FileEnumerator f1(temp_dir_.path(), true, FileEnumerator::FILES);
|
| + FileEnumerator f1(temp_dir_.GetPath(), true, FileEnumerator::FILES);
|
| FindResultCollector c1(&f1);
|
| EXPECT_TRUE(c1.HasFile(file1));
|
| EXPECT_TRUE(c1.HasFile(file2_abs));
|
| @@ -1967,7 +1972,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| EXPECT_EQ(4, c1.size());
|
|
|
| // Only enumerate directories.
|
| - FileEnumerator f2(temp_dir_.path(), true, FileEnumerator::DIRECTORIES);
|
| + FileEnumerator f2(temp_dir_.GetPath(), true, FileEnumerator::DIRECTORIES);
|
| FindResultCollector c2(&f2);
|
| EXPECT_TRUE(c2.HasFile(dir1));
|
| EXPECT_TRUE(c2.HasFile(dir2));
|
| @@ -1975,25 +1980,25 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| EXPECT_EQ(3, c2.size());
|
|
|
| // Only enumerate directories non-recursively.
|
| - FileEnumerator f2_non_recursive(
|
| - temp_dir_.path(), false, FileEnumerator::DIRECTORIES);
|
| + FileEnumerator f2_non_recursive(temp_dir_.GetPath(), 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(2, c2_non_recursive.size());
|
|
|
| // Only enumerate directories, non-recursively, including "..".
|
| - FileEnumerator f2_dotdot(temp_dir_.path(), false,
|
| - FileEnumerator::DIRECTORIES |
|
| - FileEnumerator::INCLUDE_DOT_DOT);
|
| + FileEnumerator f2_dotdot(
|
| + temp_dir_.GetPath(), false,
|
| + FileEnumerator::DIRECTORIES | FileEnumerator::INCLUDE_DOT_DOT);
|
| FindResultCollector c2_dotdot(&f2_dotdot);
|
| EXPECT_TRUE(c2_dotdot.HasFile(dir1));
|
| EXPECT_TRUE(c2_dotdot.HasFile(dir2));
|
| - EXPECT_TRUE(c2_dotdot.HasFile(temp_dir_.path().Append(FPL(".."))));
|
| + EXPECT_TRUE(c2_dotdot.HasFile(temp_dir_.GetPath().Append(FPL(".."))));
|
| EXPECT_EQ(3, c2_dotdot.size());
|
|
|
| // Enumerate files and directories.
|
| - FileEnumerator f3(temp_dir_.path(), true, FILES_AND_DIRECTORIES);
|
| + FileEnumerator f3(temp_dir_.GetPath(), true, FILES_AND_DIRECTORIES);
|
| FindResultCollector c3(&f3);
|
| EXPECT_TRUE(c3.HasFile(dir1));
|
| EXPECT_TRUE(c3.HasFile(dir2));
|
| @@ -2005,7 +2010,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| EXPECT_EQ(7, c3.size());
|
|
|
| // Non-recursive operation.
|
| - FileEnumerator f4(temp_dir_.path(), false, FILES_AND_DIRECTORIES);
|
| + FileEnumerator f4(temp_dir_.GetPath(), false, FILES_AND_DIRECTORIES);
|
| FindResultCollector c4(&f4);
|
| EXPECT_TRUE(c4.HasFile(dir2));
|
| EXPECT_TRUE(c4.HasFile(dir2));
|
| @@ -2014,7 +2019,8 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| EXPECT_EQ(4, c4.size());
|
|
|
| // Enumerate with a pattern.
|
| - FileEnumerator f5(temp_dir_.path(), true, FILES_AND_DIRECTORIES, FPL("dir*"));
|
| + FileEnumerator f5(temp_dir_.GetPath(), true, FILES_AND_DIRECTORIES,
|
| + FPL("dir*"));
|
| FindResultCollector c5(&f5);
|
| EXPECT_TRUE(c5.HasFile(dir1));
|
| EXPECT_TRUE(c5.HasFile(dir2));
|
| @@ -2043,7 +2049,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| }
|
|
|
| // No changes for non recursive operation.
|
| - FileEnumerator f7(temp_dir_.path(), false, FILES_AND_DIRECTORIES);
|
| + FileEnumerator f7(temp_dir_.GetPath(), false, FILES_AND_DIRECTORIES);
|
| FindResultCollector c7(&f7);
|
| EXPECT_TRUE(c7.HasFile(dir2));
|
| EXPECT_TRUE(c7.HasFile(dir2));
|
| @@ -2052,7 +2058,7 @@ TEST_F(FileUtilTest, FileEnumeratorTest) {
|
| EXPECT_EQ(4, c7.size());
|
|
|
| // Should not enumerate inside dir1 when using recursion.
|
| - FileEnumerator f8(temp_dir_.path(), true, FILES_AND_DIRECTORIES);
|
| + FileEnumerator f8(temp_dir_.GetPath(), true, FILES_AND_DIRECTORIES);
|
| FindResultCollector c8(&f8);
|
| EXPECT_TRUE(c8.HasFile(dir1));
|
| EXPECT_TRUE(c8.HasFile(dir2));
|
| @@ -2067,14 +2073,14 @@ 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.
|
| - FileEnumerator f9(temp_dir_.path(), true, FILES_AND_DIRECTORIES);
|
| + FileEnumerator f9(temp_dir_.GetPath(), true, FILES_AND_DIRECTORIES);
|
| EXPECT_FALSE(f9.Next().value().empty()); // Should have found something
|
| // (we don't care what).
|
| }
|
|
|
| TEST_F(FileUtilTest, AppendToFile) {
|
| FilePath data_dir =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("FilePathTest"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("FilePathTest"));
|
|
|
| // Create a fresh, empty copy of this directory.
|
| if (PathExists(data_dir)) {
|
| @@ -2103,7 +2109,7 @@ TEST_F(FileUtilTest, ReadFile) {
|
| // Create a test file to be read.
|
| const std::string kTestData("The quick brown fox jumps over the lazy dog.");
|
| FilePath file_path =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("ReadFileTest"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("ReadFileTest"));
|
|
|
| ASSERT_EQ(static_cast<int>(kTestData.size()),
|
| WriteFile(file_path, kTestData.data(), kTestData.size()));
|
| @@ -2136,7 +2142,7 @@ TEST_F(FileUtilTest, ReadFile) {
|
|
|
| // Make sure the return value is -1 if the file doesn't exist.
|
| FilePath file_path_not_exist =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("ReadFileNotExistTest"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("ReadFileNotExistTest"));
|
| EXPECT_EQ(-1,
|
| ReadFile(file_path_not_exist,
|
| &exact_buffer[0],
|
| @@ -2148,11 +2154,12 @@ TEST_F(FileUtilTest, ReadFileToString) {
|
| std::string data;
|
|
|
| FilePath file_path =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("ReadFileToStringTest"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("ReadFileToStringTest"));
|
| FilePath file_path_dangerous =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("..")).
|
| - Append(temp_dir_.path().BaseName()).
|
| - Append(FILE_PATH_LITERAL("ReadFileToStringTest"));
|
| + temp_dir_.GetPath()
|
| + .Append(FILE_PATH_LITERAL(".."))
|
| + .Append(temp_dir_.GetPath().BaseName())
|
| + .Append(FILE_PATH_LITERAL("ReadFileToStringTest"));
|
|
|
| // Create test file.
|
| ASSERT_EQ(4, WriteFile(file_path, kTestData, 4));
|
| @@ -2202,7 +2209,7 @@ TEST_F(FileUtilTest, ReadFileToString) {
|
|
|
| TEST_F(FileUtilTest, TouchFile) {
|
| FilePath data_dir =
|
| - temp_dir_.path().Append(FILE_PATH_LITERAL("FilePathTest"));
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("FilePathTest"));
|
|
|
| // Create a fresh, empty copy of this directory.
|
| if (PathExists(data_dir)) {
|
| @@ -2236,7 +2243,8 @@ TEST_F(FileUtilTest, TouchFile) {
|
| }
|
|
|
| TEST_F(FileUtilTest, IsDirectoryEmpty) {
|
| - FilePath empty_dir = temp_dir_.path().Append(FILE_PATH_LITERAL("EmptyDir"));
|
| + FilePath empty_dir =
|
| + temp_dir_.GetPath().Append(FILE_PATH_LITERAL("EmptyDir"));
|
|
|
| ASSERT_FALSE(PathExists(empty_dir));
|
|
|
| @@ -2271,7 +2279,7 @@ class VerifyPathControlledByUserTest : public FileUtilTest {
|
| // |-> sub_dir_
|
| // |-> text_file_
|
|
|
| - base_dir_ = temp_dir_.path().AppendASCII("base_dir");
|
| + base_dir_ = temp_dir_.GetPath().AppendASCII("base_dir");
|
| ASSERT_TRUE(CreateDirectory(base_dir_));
|
|
|
| sub_dir_ = base_dir_.AppendASCII("sub_dir");
|
|
|