| 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 "webkit/browser/fileapi/file_system_operation_impl.h" | 5 #include "webkit/browser/fileapi/file_system_operation_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 EXPECT_EQ(3, change_observer()->get_and_reset_remove_directory_count()); | 438 EXPECT_EQ(3, change_observer()->get_and_reset_remove_directory_count()); |
| 439 EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count()); | 439 EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count()); |
| 440 EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count()); | 440 EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count()); |
| 441 EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count()); | 441 EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count()); |
| 442 EXPECT_TRUE(change_observer()->HasNoChange()); | 442 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 443 } | 443 } |
| 444 | 444 |
| 445 TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDoesntExist) { | 445 TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDoesntExist) { |
| 446 operation_runner()->Copy(URLForPath("a"), URLForPath("b"), | 446 operation_runner()->Copy(URLForPath("a"), URLForPath("b"), |
| 447 FileSystemOperationRunner::CopyProgressCallback(), |
| 447 RecordStatusCallback()); | 448 RecordStatusCallback()); |
| 448 base::MessageLoop::current()->RunUntilIdle(); | 449 base::MessageLoop::current()->RunUntilIdle(); |
| 449 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status()); | 450 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status()); |
| 450 EXPECT_TRUE(change_observer()->HasNoChange()); | 451 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 451 } | 452 } |
| 452 | 453 |
| 453 TEST_F(FileSystemOperationImplTest, TestCopyFailureContainsPath) { | 454 TEST_F(FileSystemOperationImplTest, TestCopyFailureContainsPath) { |
| 454 FileSystemURL src_dir(CreateDirectory("src")); | 455 FileSystemURL src_dir(CreateDirectory("src")); |
| 455 FileSystemURL dest_dir(CreateDirectory("src/dir")); | 456 FileSystemURL dest_dir(CreateDirectory("src/dir")); |
| 456 | 457 |
| 457 operation_runner()->Copy(src_dir, dest_dir, RecordStatusCallback()); | 458 operation_runner()->Copy(src_dir, dest_dir, |
| 459 FileSystemOperationRunner::CopyProgressCallback(), |
| 460 RecordStatusCallback()); |
| 458 base::MessageLoop::current()->RunUntilIdle(); | 461 base::MessageLoop::current()->RunUntilIdle(); |
| 459 EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status()); | 462 EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status()); |
| 460 EXPECT_TRUE(change_observer()->HasNoChange()); | 463 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 461 } | 464 } |
| 462 | 465 |
| 463 TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDirExistsDestFile) { | 466 TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDirExistsDestFile) { |
| 464 // Src exists and is dir. Dest is a file. | 467 // Src exists and is dir. Dest is a file. |
| 465 FileSystemURL src_dir(CreateDirectory("src")); | 468 FileSystemURL src_dir(CreateDirectory("src")); |
| 466 FileSystemURL dest_dir(CreateDirectory("dest")); | 469 FileSystemURL dest_dir(CreateDirectory("dest")); |
| 467 FileSystemURL dest_file(CreateFile("dest/file")); | 470 FileSystemURL dest_file(CreateFile("dest/file")); |
| 468 | 471 |
| 469 operation_runner()->Copy(src_dir, dest_file, RecordStatusCallback()); | 472 operation_runner()->Copy(src_dir, dest_file, |
| 473 FileSystemOperationRunner::CopyProgressCallback(), |
| 474 RecordStatusCallback()); |
| 470 base::MessageLoop::current()->RunUntilIdle(); | 475 base::MessageLoop::current()->RunUntilIdle(); |
| 471 EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status()); | 476 EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status()); |
| 472 EXPECT_TRUE(change_observer()->HasNoChange()); | 477 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 473 } | 478 } |
| 474 | 479 |
| 475 TEST_F(FileSystemOperationImplTest, | 480 TEST_F(FileSystemOperationImplTest, |
| 476 TestCopyFailureSrcFileExistsDestNonEmptyDir) { | 481 TestCopyFailureSrcFileExistsDestNonEmptyDir) { |
| 477 // Src exists and is a directory. Dest is a non-empty directory. | 482 // Src exists and is a directory. Dest is a non-empty directory. |
| 478 FileSystemURL src_dir(CreateDirectory("src")); | 483 FileSystemURL src_dir(CreateDirectory("src")); |
| 479 FileSystemURL dest_dir(CreateDirectory("dest")); | 484 FileSystemURL dest_dir(CreateDirectory("dest")); |
| 480 FileSystemURL dest_file(CreateFile("dest/file")); | 485 FileSystemURL dest_file(CreateFile("dest/file")); |
| 481 | 486 |
| 482 operation_runner()->Copy(src_dir, dest_dir, RecordStatusCallback()); | 487 operation_runner()->Copy(src_dir, dest_dir, |
| 488 FileSystemOperationRunner::CopyProgressCallback(), |
| 489 RecordStatusCallback()); |
| 483 base::MessageLoop::current()->RunUntilIdle(); | 490 base::MessageLoop::current()->RunUntilIdle(); |
| 484 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, status()); | 491 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, status()); |
| 485 EXPECT_TRUE(change_observer()->HasNoChange()); | 492 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 486 } | 493 } |
| 487 | 494 |
| 488 TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcFileExistsDestDir) { | 495 TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcFileExistsDestDir) { |
| 489 // Src exists and is a file. Dest is a directory. | 496 // Src exists and is a file. Dest is a directory. |
| 490 FileSystemURL src_file(CreateFile("src")); | 497 FileSystemURL src_file(CreateFile("src")); |
| 491 FileSystemURL dest_dir(CreateDirectory("dest")); | 498 FileSystemURL dest_dir(CreateDirectory("dest")); |
| 492 | 499 |
| 493 operation_runner()->Copy(src_file, dest_dir, RecordStatusCallback()); | 500 operation_runner()->Copy(src_file, dest_dir, |
| 501 FileSystemOperationRunner::CopyProgressCallback(), |
| 502 RecordStatusCallback()); |
| 494 base::MessageLoop::current()->RunUntilIdle(); | 503 base::MessageLoop::current()->RunUntilIdle(); |
| 495 EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status()); | 504 EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, status()); |
| 496 EXPECT_TRUE(change_observer()->HasNoChange()); | 505 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 497 } | 506 } |
| 498 | 507 |
| 499 TEST_F(FileSystemOperationImplTest, TestCopyFailureDestParentDoesntExist) { | 508 TEST_F(FileSystemOperationImplTest, TestCopyFailureDestParentDoesntExist) { |
| 500 // Dest. parent path does not exist. | 509 // Dest. parent path does not exist. |
| 501 FileSystemURL src_dir(CreateDirectory("src")); | 510 FileSystemURL src_dir(CreateDirectory("src")); |
| 502 | 511 |
| 503 operation_runner()->Copy(src_dir, URLForPath("nonexistent/dest"), | 512 operation_runner()->Copy(src_dir, URLForPath("nonexistent/dest"), |
| 513 FileSystemOperationRunner::CopyProgressCallback(), |
| 504 RecordStatusCallback()); | 514 RecordStatusCallback()); |
| 505 base::MessageLoop::current()->RunUntilIdle(); | 515 base::MessageLoop::current()->RunUntilIdle(); |
| 506 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status()); | 516 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status()); |
| 507 EXPECT_TRUE(change_observer()->HasNoChange()); | 517 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 508 } | 518 } |
| 509 | 519 |
| 510 TEST_F(FileSystemOperationImplTest, TestCopyFailureByQuota) { | 520 TEST_F(FileSystemOperationImplTest, TestCopyFailureByQuota) { |
| 511 FileSystemURL src_dir(CreateDirectory("src")); | 521 FileSystemURL src_dir(CreateDirectory("src")); |
| 512 FileSystemURL src_file(CreateFile("src/file")); | 522 FileSystemURL src_file(CreateFile("src/file")); |
| 513 FileSystemURL dest_dir(CreateDirectory("dest")); | 523 FileSystemURL dest_dir(CreateDirectory("dest")); |
| 514 operation_runner()->Truncate(src_file, 6, RecordStatusCallback()); | 524 operation_runner()->Truncate(src_file, 6, RecordStatusCallback()); |
| 515 base::MessageLoop::current()->RunUntilIdle(); | 525 base::MessageLoop::current()->RunUntilIdle(); |
| 516 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 526 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 517 EXPECT_EQ(6, GetFileSize("src/file")); | 527 EXPECT_EQ(6, GetFileSize("src/file")); |
| 518 | 528 |
| 519 FileSystemURL dest_file(URLForPath("dest/file")); | 529 FileSystemURL dest_file(URLForPath("dest/file")); |
| 520 int64 dest_path_cost = ComputePathCost(dest_file); | 530 int64 dest_path_cost = ComputePathCost(dest_file); |
| 521 GrantQuotaForCurrentUsage(); | 531 GrantQuotaForCurrentUsage(); |
| 522 AddQuota(6 + dest_path_cost - 1); | 532 AddQuota(6 + dest_path_cost - 1); |
| 523 | 533 |
| 524 operation_runner()->Copy(src_file, dest_file, RecordStatusCallback()); | 534 operation_runner()->Copy(src_file, dest_file, |
| 535 FileSystemOperationRunner::CopyProgressCallback(), |
| 536 RecordStatusCallback()); |
| 525 base::MessageLoop::current()->RunUntilIdle(); | 537 base::MessageLoop::current()->RunUntilIdle(); |
| 526 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); | 538 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); |
| 527 EXPECT_FALSE(FileExists("dest/file")); | 539 EXPECT_FALSE(FileExists("dest/file")); |
| 528 } | 540 } |
| 529 | 541 |
| 530 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndOverwrite) { | 542 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndOverwrite) { |
| 531 FileSystemURL src_file(CreateFile("src")); | 543 FileSystemURL src_file(CreateFile("src")); |
| 532 FileSystemURL dest_file(CreateFile("dest")); | 544 FileSystemURL dest_file(CreateFile("dest")); |
| 533 | 545 |
| 534 operation_runner()->Copy(src_file, dest_file, RecordStatusCallback()); | 546 operation_runner()->Copy(src_file, dest_file, |
| 547 FileSystemOperationRunner::CopyProgressCallback(), |
| 548 RecordStatusCallback()); |
| 535 base::MessageLoop::current()->RunUntilIdle(); | 549 base::MessageLoop::current()->RunUntilIdle(); |
| 536 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 550 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 537 EXPECT_TRUE(FileExists("dest")); | 551 EXPECT_TRUE(FileExists("dest")); |
| 538 EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count()); | 552 EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count()); |
| 539 | 553 |
| 540 EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count()); | 554 EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count()); |
| 541 EXPECT_TRUE(change_observer()->HasNoChange()); | 555 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 542 } | 556 } |
| 543 | 557 |
| 544 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndNew) { | 558 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndNew) { |
| 545 FileSystemURL src_file(CreateFile("src")); | 559 FileSystemURL src_file(CreateFile("src")); |
| 546 | 560 |
| 547 operation_runner()->Copy(src_file, URLForPath("new"), | 561 operation_runner()->Copy(src_file, URLForPath("new"), |
| 562 FileSystemOperationRunner::CopyProgressCallback(), |
| 548 RecordStatusCallback()); | 563 RecordStatusCallback()); |
| 549 base::MessageLoop::current()->RunUntilIdle(); | 564 base::MessageLoop::current()->RunUntilIdle(); |
| 550 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 565 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 551 EXPECT_TRUE(FileExists("new")); | 566 EXPECT_TRUE(FileExists("new")); |
| 552 EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count()); | 567 EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count()); |
| 553 | 568 |
| 554 EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count()); | 569 EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count()); |
| 555 EXPECT_TRUE(change_observer()->HasNoChange()); | 570 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 556 } | 571 } |
| 557 | 572 |
| 558 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndOverwrite) { | 573 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndOverwrite) { |
| 559 FileSystemURL src_dir(CreateDirectory("src")); | 574 FileSystemURL src_dir(CreateDirectory("src")); |
| 560 FileSystemURL dest_dir(CreateDirectory("dest")); | 575 FileSystemURL dest_dir(CreateDirectory("dest")); |
| 561 | 576 |
| 562 operation_runner()->Copy(src_dir, dest_dir, RecordStatusCallback()); | 577 operation_runner()->Copy(src_dir, dest_dir, |
| 578 FileSystemOperationRunner::CopyProgressCallback(), |
| 579 RecordStatusCallback()); |
| 563 base::MessageLoop::current()->RunUntilIdle(); | 580 base::MessageLoop::current()->RunUntilIdle(); |
| 564 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 581 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 565 | 582 |
| 566 // Make sure we've overwritten but not copied the source under the |dest_dir|. | 583 // Make sure we've overwritten but not copied the source under the |dest_dir|. |
| 567 EXPECT_TRUE(DirectoryExists("dest")); | 584 EXPECT_TRUE(DirectoryExists("dest")); |
| 568 EXPECT_FALSE(DirectoryExists("dest/src")); | 585 EXPECT_FALSE(DirectoryExists("dest/src")); |
| 569 EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 3); | 586 EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 3); |
| 570 | 587 |
| 571 EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count()); | 588 EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count()); |
| 572 EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count()); | 589 EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count()); |
| 573 EXPECT_TRUE(change_observer()->HasNoChange()); | 590 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 574 } | 591 } |
| 575 | 592 |
| 576 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndNew) { | 593 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndNew) { |
| 577 FileSystemURL src_dir(CreateDirectory("src")); | 594 FileSystemURL src_dir(CreateDirectory("src")); |
| 578 FileSystemURL dest_dir_new(URLForPath("dest")); | 595 FileSystemURL dest_dir_new(URLForPath("dest")); |
| 579 | 596 |
| 580 operation_runner()->Copy(src_dir, dest_dir_new, RecordStatusCallback()); | 597 operation_runner()->Copy(src_dir, dest_dir_new, |
| 598 FileSystemOperationRunner::CopyProgressCallback(), |
| 599 RecordStatusCallback()); |
| 581 base::MessageLoop::current()->RunUntilIdle(); | 600 base::MessageLoop::current()->RunUntilIdle(); |
| 582 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 601 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 583 EXPECT_TRUE(DirectoryExists("dest")); | 602 EXPECT_TRUE(DirectoryExists("dest")); |
| 584 EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 2); | 603 EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 2); |
| 585 | 604 |
| 586 EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count()); | 605 EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count()); |
| 587 EXPECT_TRUE(change_observer()->HasNoChange()); | 606 EXPECT_TRUE(change_observer()->HasNoChange()); |
| 588 } | 607 } |
| 589 | 608 |
| 590 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursive) { | 609 TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursive) { |
| 591 FileSystemURL src_dir(CreateDirectory("src")); | 610 FileSystemURL src_dir(CreateDirectory("src")); |
| 592 CreateDirectory("src/dir"); | 611 CreateDirectory("src/dir"); |
| 593 CreateFile("src/dir/sub"); | 612 CreateFile("src/dir/sub"); |
| 594 | 613 |
| 595 FileSystemURL dest_dir(CreateDirectory("dest")); | 614 FileSystemURL dest_dir(CreateDirectory("dest")); |
| 596 | 615 |
| 597 operation_runner()->Copy(src_dir, dest_dir, RecordStatusCallback()); | 616 operation_runner()->Copy(src_dir, dest_dir, |
| 617 FileSystemOperationRunner::CopyProgressCallback(), |
| 618 RecordStatusCallback()); |
| 598 base::MessageLoop::current()->RunUntilIdle(); | 619 base::MessageLoop::current()->RunUntilIdle(); |
| 599 | 620 |
| 600 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 621 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 601 EXPECT_TRUE(DirectoryExists("dest/dir")); | 622 EXPECT_TRUE(DirectoryExists("dest/dir")); |
| 602 EXPECT_TRUE(FileExists("dest/dir/sub")); | 623 EXPECT_TRUE(FileExists("dest/dir/sub")); |
| 603 | 624 |
| 604 // For recursive copy we may record multiple read access. | 625 // For recursive copy we may record multiple read access. |
| 605 EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 1); | 626 EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 1); |
| 606 | 627 |
| 607 EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count()); | 628 EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count()); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 const int64 all_file_size = child_file_size + grandchild_file_size; | 1173 const int64 all_file_size = child_file_size + grandchild_file_size; |
| 1153 int64 expected_usage = all_file_size + total_path_cost; | 1174 int64 expected_usage = all_file_size + total_path_cost; |
| 1154 | 1175 |
| 1155 usage = GetUsage(); | 1176 usage = GetUsage(); |
| 1156 EXPECT_EQ(all_file_size, GetDataSizeOnDisk()); | 1177 EXPECT_EQ(all_file_size, GetDataSizeOnDisk()); |
| 1157 EXPECT_EQ(expected_usage, usage); | 1178 EXPECT_EQ(expected_usage, usage); |
| 1158 | 1179 |
| 1159 // Copy src to dest1. | 1180 // Copy src to dest1. |
| 1160 operation_runner()->Copy( | 1181 operation_runner()->Copy( |
| 1161 src, dest1, | 1182 src, dest1, |
| 1183 FileSystemOperationRunner::CopyProgressCallback(), |
| 1162 base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK)); | 1184 base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK)); |
| 1163 base::MessageLoop::current()->RunUntilIdle(); | 1185 base::MessageLoop::current()->RunUntilIdle(); |
| 1164 | 1186 |
| 1165 expected_usage += all_file_size + child_path_cost + grandchild_path_cost; | 1187 expected_usage += all_file_size + child_path_cost + grandchild_path_cost; |
| 1166 EXPECT_TRUE(DirectoryExists("src/dir")); | 1188 EXPECT_TRUE(DirectoryExists("src/dir")); |
| 1167 EXPECT_TRUE(FileExists("src/dir/file2")); | 1189 EXPECT_TRUE(FileExists("src/dir/file2")); |
| 1168 EXPECT_TRUE(DirectoryExists("dest1/dir")); | 1190 EXPECT_TRUE(DirectoryExists("dest1/dir")); |
| 1169 EXPECT_TRUE(FileExists("dest1/dir/file2")); | 1191 EXPECT_TRUE(FileExists("dest1/dir/file2")); |
| 1170 | 1192 |
| 1171 EXPECT_EQ(2 * all_file_size, GetDataSizeOnDisk()); | 1193 EXPECT_EQ(2 * all_file_size, GetDataSizeOnDisk()); |
| 1172 EXPECT_EQ(expected_usage, GetUsage()); | 1194 EXPECT_EQ(expected_usage, GetUsage()); |
| 1173 | 1195 |
| 1174 // Copy src/dir to dest2. | 1196 // Copy src/dir to dest2. |
| 1175 operation_runner()->Copy( | 1197 operation_runner()->Copy( |
| 1176 child_dir, dest2, | 1198 child_dir, dest2, |
| 1199 FileSystemOperationRunner::CopyProgressCallback(), |
| 1177 base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK)); | 1200 base::Bind(&AssertFileErrorEq, FROM_HERE, base::PLATFORM_FILE_OK)); |
| 1178 base::MessageLoop::current()->RunUntilIdle(); | 1201 base::MessageLoop::current()->RunUntilIdle(); |
| 1179 | 1202 |
| 1180 expected_usage += grandchild_file_size + grandchild_path_cost; | 1203 expected_usage += grandchild_file_size + grandchild_path_cost; |
| 1181 usage = GetUsage(); | 1204 usage = GetUsage(); |
| 1182 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, | 1205 EXPECT_EQ(2 * child_file_size + 3 * grandchild_file_size, |
| 1183 GetDataSizeOnDisk()); | 1206 GetDataSizeOnDisk()); |
| 1184 EXPECT_EQ(expected_usage, usage); | 1207 EXPECT_EQ(expected_usage, usage); |
| 1185 } | 1208 } |
| 1186 | 1209 |
| 1187 } // namespace fileapi | 1210 } // namespace fileapi |
| OLD | NEW |