| Index: base/file_util_unittest.cc
|
| diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
|
| index 452ee82def457b904c048ddab95357e50ff52d05..c1006e1304c205c52a7e58b38e9d7e8ade80e60d 100644
|
| --- a/base/file_util_unittest.cc
|
| +++ b/base/file_util_unittest.cc
|
| @@ -1466,6 +1466,43 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExistingDirectory) {
|
| EXPECT_TRUE(file_util::PathExists(file_name_to));
|
| }
|
|
|
| +TEST_F(FileUtilTest, CopyDirectoryWithTrailingSeparators) {
|
| + // Create a directory.
|
| + FilePath dir_name_from =
|
| + temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir"));
|
| + file_util::CreateDirectory(dir_name_from);
|
| + ASSERT_TRUE(file_util::PathExists(dir_name_from));
|
| +
|
| + // Create a file under the directory.
|
| + FilePath file_name_from =
|
| + dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt"));
|
| + CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle");
|
| + ASSERT_TRUE(file_util::PathExists(file_name_from));
|
| +
|
| + // Copy the directory recursively.
|
| + FilePath dir_name_to =
|
| + temp_dir_.path().Append(FILE_PATH_LITERAL("Destination"));
|
| + 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\\\\\\"));
|
| +#elif defined(OS_POSIX)
|
| + FilePath from_path =
|
| + temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir///"));
|
| +#endif
|
| +
|
| + EXPECT_TRUE(file_util::CopyDirectory(from_path, dir_name_to, true));
|
| +
|
| + // Check everything has been copied.
|
| + EXPECT_TRUE(file_util::PathExists(dir_name_from));
|
| + EXPECT_TRUE(file_util::PathExists(file_name_from));
|
| + EXPECT_TRUE(file_util::PathExists(dir_name_to));
|
| + EXPECT_TRUE(file_util::PathExists(file_name_to));
|
| +}
|
| +
|
| TEST_F(FileUtilTest, CopyFile) {
|
| // Create a directory
|
| FilePath dir_name_from =
|
|
|