| Index: base/file_util_unittest.cc
|
| diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
|
| index ea29df521720c8de2c4801c10f7c8e2a96cadd83..b5d989f774ba24867d7ea02dbbd4509588d46fa0 100644
|
| --- a/base/file_util_unittest.cc
|
| +++ b/base/file_util_unittest.cc
|
| @@ -1813,4 +1813,38 @@ TEST_F(FileUtilTest, IsDirectoryEmpty) {
|
| EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir));
|
| }
|
|
|
| +TEST_F(FileUtilTest, AreReferringToSameObject) {
|
| + FilePath dir1 = temp_dir_.path().Append(FILE_PATH_LITERAL("Directory"));
|
| + FilePath dir2 = temp_dir_.path().Append(FILE_PATH_LITERAL("Directory"));
|
| + ASSERT_FALSE(file_util::PathExists(dir1));
|
| + ASSERT_TRUE(file_util::CreateDirectory(dir1));
|
| + ASSERT_TRUE(file_util::AreReferringToSameObject(dir1, dir2));
|
| + ASSERT_FALSE(file_util::AreReferringToSameObject(temp_dir_.path(), dir2));
|
| +
|
| +#if defined(OS_POSIX)
|
| + FilePath sym = temp_dir_.path().Append(FILE_PATH_LITERAL("Symlink"));
|
| + ASSERT_FALSE(file_util::AreReferringToSameObject(dir1, sym));
|
| + ASSERT_TRUE(file_util::CreateSymbolicLink(dir1, sym));
|
| + ASSERT_TRUE(file_util::AreReferringToSameObject(dir1, sym));
|
| +#endif // OS_POSIX
|
| +}
|
| +
|
| +#if defined(OS_MACOSX)
|
| +TEST_F(FileUtilTest, Trash) {
|
| + FilePath to_trash = temp_dir_.path().Append(FILE_PATH_LITERAL("TrashFile"));
|
| + ASSERT_FALSE(file_util::PathExists(to_trash));
|
| + std::string bar("baz");
|
| + ASSERT_TRUE(file_util::WriteFile(to_trash, bar.c_str(), bar.length()));
|
| + ASSERT_TRUE(file_util::PathExists(to_trash));
|
| + ASSERT_FALSE(file_util::IsInTrash(to_trash));
|
| +
|
| + FilePath trashed;
|
| + ASSERT_TRUE(file_util::MoveToTrash(to_trash, &trashed));
|
| + ASSERT_TRUE(file_util::IsInTrash(trashed));
|
| + ASSERT_FALSE(file_util::IsInTrash(to_trash));
|
| + ASSERT_FALSE(file_util::PathExists(to_trash));
|
| + ASSERT_FALSE(file_util::MoveToTrash(to_trash, &trashed));
|
| +}
|
| +#endif // OS_MACOSX
|
| +
|
| } // namespace
|
|
|