| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/fileapi/syncable/local_file_sync_context.h" | 5 #include "webkit/fileapi/syncable/local_file_sync_context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 SYNC_FILE_TYPE_DIRECTORY); | 565 SYNC_FILE_TYPE_DIRECTORY); |
| 566 EXPECT_EQ(SYNC_STATUS_OK, | 566 EXPECT_EQ(SYNC_STATUS_OK, |
| 567 ApplyRemoteChange(file_system.file_system_context(), | 567 ApplyRemoteChange(file_system.file_system_context(), |
| 568 change, FilePath(), kDir, | 568 change, FilePath(), kDir, |
| 569 SYNC_FILE_TYPE_UNKNOWN)); | 569 SYNC_FILE_TYPE_UNKNOWN)); |
| 570 | 570 |
| 571 // This should not happen, but calling ApplyRemoteChange | 571 // This should not happen, but calling ApplyRemoteChange |
| 572 // with wrong file type will result in error. | 572 // with wrong file type will result in error. |
| 573 change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 573 change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
| 574 SYNC_FILE_TYPE_FILE); | 574 SYNC_FILE_TYPE_FILE); |
| 575 EXPECT_EQ(SYNC_FILE_ERROR_FAILED, | 575 EXPECT_NE(SYNC_STATUS_OK, |
| 576 ApplyRemoteChange(file_system.file_system_context(), | 576 ApplyRemoteChange(file_system.file_system_context(), |
| 577 change, kFilePath1, kDir, | 577 change, kFilePath1, kDir, |
| 578 SYNC_FILE_TYPE_DIRECTORY)); | 578 SYNC_FILE_TYPE_DIRECTORY)); |
| 579 | 579 |
| 580 // Creating a file/directory must have increased the usage more than | 580 // Creating a file/directory must have increased the usage more than |
| 581 // the size of kTestFileData2. | 581 // the size of kTestFileData2. |
| 582 new_usage = usage; | 582 new_usage = usage; |
| 583 EXPECT_EQ(quota::kQuotaStatusOk, | 583 EXPECT_EQ(quota::kQuotaStatusOk, |
| 584 file_system.GetUsageAndQuota(&new_usage, "a)); | 584 file_system.GetUsageAndQuota(&new_usage, "a)); |
| 585 EXPECT_GT(new_usage, | 585 EXPECT_GT(new_usage, |
| 586 static_cast<int64>(usage + arraysize(kTestFileData2) - 1)); | 586 static_cast<int64>(usage + arraysize(kTestFileData2) - 1)); |
| 587 | 587 |
| 588 // The changes applied by ApplyRemoteChange should not be recorded in | 588 // The changes applied by ApplyRemoteChange should not be recorded in |
| 589 // the change tracker. | 589 // the change tracker. |
| 590 urls.clear(); | 590 urls.clear(); |
| 591 file_system.GetChangedURLsInTracker(&urls); | 591 file_system.GetChangedURLsInTracker(&urls); |
| 592 EXPECT_TRUE(urls.empty()); | 592 EXPECT_TRUE(urls.empty()); |
| 593 | 593 |
| 594 // Make sure all three files/directory exist. | 594 // Make sure all three files/directory exist. |
| 595 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile1)); | 595 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile1)); |
| 596 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile2)); | 596 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile2)); |
| 597 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir)); | 597 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir)); |
| 598 | 598 |
| 599 sync_context_->ShutdownOnUIThread(); | 599 sync_context_->ShutdownOnUIThread(); |
| 600 file_system.TearDown(); | 600 file_system.TearDown(); |
| 601 } | 601 } |
| 602 | 602 |
| 603 } // namespace fileapi | 603 } // namespace fileapi |
| OLD | NEW |