Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1065)

Unified Diff: content/browser/fileapi/file_system_operation_impl_unittest.cc

Issue 536453007: Add truncation to StreamCopyOrMoveImpl and test case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/browser/fileapi/copy_or_move_operation_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | webkit/browser/fileapi/copy_or_move_operation_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698