Index: content/browser/fileapi/file_system_operation_impl_unittest.cc |
diff --git a/content/browser/fileapi/file_system_operation_impl_unittest.cc b/content/browser/fileapi/file_system_operation_impl_unittest.cc |
index afbe664aaf2b3233a9ded3ebfd43aab94a848997..0399fe6ebaa62441dcdea33e11c45dd5bd8b16ee 100644 |
--- a/content/browser/fileapi/file_system_operation_impl_unittest.cc |
+++ b/content/browser/fileapi/file_system_operation_impl_unittest.cc |
@@ -50,6 +50,15 @@ void AssertFileErrorEq(const tracked_objects::Location& from_here, |
ASSERT_EQ(expected, actual) << from_here.ToString(); |
} |
+void AssertFileErrorEqWithClosure( |
+ const tracked_objects::Location& from_here, |
+ base::File::Error expected, |
+ base::Closure closure, |
+ base::File::Error actual) { |
+ ASSERT_EQ(expected, actual) << from_here.ToString(); |
+ closure.Run(); |
+} |
+ |
} // namespace |
// Test class for FileSystemOperationImpl. |
@@ -1287,4 +1296,34 @@ TEST_F(FileSystemOperationImplTest, |
EXPECT_EQ(expected_usage, usage); |
} |
+TEST_F(FileSystemOperationImplTest, |
+ TestCopySuccessSrcFileWithDifferentFileSize) { |
+ FileSystemURL src_file(CreateFile("src")); |
+ FileSystemURL dest_file(CreateFile("dest")); |
+ |
+ { |
+ base::RunLoop run_loop; |
+ operation_runner()->Truncate( |
+ dest_file, 6, |
+ base::Bind(&AssertFileErrorEqWithClosure, |
+ FROM_HERE, |
+ base::File::FILE_OK, |
+ run_loop.QuitClosure())); |
+ run_loop.Run(); |
+ } |
+ |
+ { |
+ base::RunLoop run_loop; |
+ operation_runner()->Copy( |
+ src_file, dest_file, FileSystemOperation::OPTION_NONE, |
+ FileSystemOperationRunner::CopyProgressCallback(), |
+ base::Bind(&AssertFileErrorEqWithClosure, |
+ FROM_HERE, |
+ base::File::FILE_OK, |
+ run_loop.QuitClosure())); |
+ run_loop.Run(); |
+ } |
+ EXPECT_EQ(0, GetFileSize("dest")); |
+} |
+ |
} // namespace content |