OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "storage/browser/fileapi/file_system_operation_impl.h" | 5 #include "storage/browser/fileapi/file_system_operation_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 309 } |
310 | 310 |
311 base::File::Error Copy( | 311 base::File::Error Copy( |
312 const FileSystemURL& src, | 312 const FileSystemURL& src, |
313 const FileSystemURL& dest, | 313 const FileSystemURL& dest, |
314 storage::FileSystemOperation::CopyOrMoveOption option) { | 314 storage::FileSystemOperation::CopyOrMoveOption option) { |
315 base::File::Error status; | 315 base::File::Error status; |
316 base::RunLoop run_loop; | 316 base::RunLoop run_loop; |
317 update_observer_.Enable(); | 317 update_observer_.Enable(); |
318 operation_runner()->Copy( | 318 operation_runner()->Copy( |
319 src, | 319 src, dest, option, |
320 dest, | 320 storage::FileSystemOperation::ERROR_BEHAVIOR_TERMINATE, |
321 option, | |
322 FileSystemOperationRunner::CopyProgressCallback(), | 321 FileSystemOperationRunner::CopyProgressCallback(), |
323 RecordStatusCallback(run_loop.QuitClosure(), &status)); | 322 RecordStatusCallback(run_loop.QuitClosure(), &status)); |
324 run_loop.Run(); | 323 run_loop.Run(); |
325 update_observer_.Disable(); | 324 update_observer_.Disable(); |
326 return status; | 325 return status; |
327 } | 326 } |
328 | 327 |
329 base::File::Error CopyInForeignFile(const base::FilePath& src, | 328 base::File::Error CopyInForeignFile(const base::FilePath& src, |
330 const FileSystemURL& dest) { | 329 const FileSystemURL& dest) { |
331 base::File::Error status; | 330 base::File::Error status; |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 FileSystemURL src_file(CreateFile("src")); | 1287 FileSystemURL src_file(CreateFile("src")); |
1289 FileSystemURL dest_file(CreateFile("dest")); | 1288 FileSystemURL dest_file(CreateFile("dest")); |
1290 | 1289 |
1291 EXPECT_EQ(base::File::FILE_OK, Truncate(dest_file, 6)); | 1290 EXPECT_EQ(base::File::FILE_OK, Truncate(dest_file, 6)); |
1292 EXPECT_EQ(base::File::FILE_OK, | 1291 EXPECT_EQ(base::File::FILE_OK, |
1293 Copy(src_file, dest_file, FileSystemOperation::OPTION_NONE)); | 1292 Copy(src_file, dest_file, FileSystemOperation::OPTION_NONE)); |
1294 EXPECT_EQ(0, GetFileSize("dest")); | 1293 EXPECT_EQ(0, GetFileSize("dest")); |
1295 } | 1294 } |
1296 | 1295 |
1297 } // namespace content | 1296 } // namespace content |
OLD | NEW |