| Index: webkit/fileapi/syncable/local_file_sync_context_unittest.cc
|
| diff --git a/webkit/fileapi/syncable/local_file_sync_context_unittest.cc b/webkit/fileapi/syncable/local_file_sync_context_unittest.cc
|
| index 4cb59c708f70cd17f678ed2ab7cdc4ae87059a3b..bc51c9b4a90a489854ee601b44f5c659b60011fc 100644
|
| --- a/webkit/fileapi/syncable/local_file_sync_context_unittest.cc
|
| +++ b/webkit/fileapi/syncable/local_file_sync_context_unittest.cc
|
| @@ -34,6 +34,10 @@
|
| // that involve LocalFileSyncContext are also in
|
| // syncable_file_system_unittests.cc.
|
|
|
| +using sync_file_system::FileChange;
|
| +using sync_file_system::FileChangeList;
|
| +using sync_file_system::SyncFileType;
|
| +
|
| namespace fileapi {
|
|
|
| namespace {
|
| @@ -307,7 +311,7 @@ TEST_F(LocalFileSyncContextTest, MultipleFileSystemContexts) {
|
| EXPECT_EQ(1U, changes.size());
|
| EXPECT_TRUE(changes.list().back().IsFile());
|
| EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
|
| - EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type);
|
| + EXPECT_EQ(sync_file_system::SYNC_FILE_TYPE_FILE, metadata.file_type);
|
| EXPECT_EQ(0, metadata.size);
|
|
|
| changes.clear();
|
| @@ -316,7 +320,7 @@ TEST_F(LocalFileSyncContextTest, MultipleFileSystemContexts) {
|
| EXPECT_EQ(1U, changes.size());
|
| EXPECT_FALSE(changes.list().back().IsFile());
|
| EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
|
| - EXPECT_EQ(SYNC_FILE_TYPE_DIRECTORY, metadata.file_type);
|
| + EXPECT_EQ(sync_file_system::SYNC_FILE_TYPE_DIRECTORY, metadata.file_type);
|
| EXPECT_EQ(0, metadata.size);
|
|
|
| sync_context_->ShutdownOnUIThread();
|
| @@ -346,17 +350,17 @@ TEST_F(LocalFileSyncContextTest, PrepareSyncWhileWriting) {
|
|
|
| // Until the operation finishes PrepareForSync should return BUSY error.
|
| SyncFileMetadata metadata;
|
| - metadata.file_type = SYNC_FILE_TYPE_UNKNOWN;
|
| + metadata.file_type = sync_file_system::SYNC_FILE_TYPE_UNKNOWN;
|
| FileChangeList changes;
|
| EXPECT_EQ(SYNC_STATUS_FILE_BUSY,
|
| PrepareForSync(file_system.file_system_context(),
|
| kURL1, &metadata, &changes));
|
| - EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type);
|
| + EXPECT_EQ(sync_file_system::SYNC_FILE_TYPE_FILE, metadata.file_type);
|
|
|
| // Register PrepareForSync method to be invoked when kURL1 becomes
|
| // syncable. (Actually this may be done after all operations are done
|
| // on IO thread in this test.)
|
| - metadata.file_type = SYNC_FILE_TYPE_UNKNOWN;
|
| + metadata.file_type = sync_file_system::SYNC_FILE_TYPE_UNKNOWN;
|
| changes.clear();
|
| sync_context_->RegisterURLForWaitingSync(
|
| kURL1, GetPrepareForSyncClosure(file_system.file_system_context(),
|
| @@ -375,7 +379,7 @@ TEST_F(LocalFileSyncContextTest, PrepareSyncWhileWriting) {
|
| EXPECT_EQ(1U, changes.size());
|
| EXPECT_TRUE(changes.list().back().IsFile());
|
| EXPECT_TRUE(changes.list().back().IsAddOrUpdate());
|
| - EXPECT_EQ(SYNC_FILE_TYPE_FILE, metadata.file_type);
|
| + EXPECT_EQ(sync_file_system::SYNC_FILE_TYPE_FILE, metadata.file_type);
|
| EXPECT_EQ(1, metadata.size);
|
|
|
| sync_context_->ShutdownOnUIThread();
|
| @@ -428,19 +432,20 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) {
|
|
|
| // Now let's apply remote deletion changes.
|
| FileChange change(FileChange::FILE_CHANGE_DELETE,
|
| - SYNC_FILE_TYPE_FILE);
|
| + sync_file_system::SYNC_FILE_TYPE_FILE);
|
| EXPECT_EQ(SYNC_STATUS_OK,
|
| ApplyRemoteChange(file_system.file_system_context(),
|
| change, base::FilePath(), kFile,
|
| - SYNC_FILE_TYPE_FILE));
|
| + sync_file_system::SYNC_FILE_TYPE_FILE));
|
|
|
| // The implementation doesn't check file type for deletion, and it must be ok
|
| // even if we don't know if the deletion change was for a file or a directory.
|
| - change = FileChange(FileChange::FILE_CHANGE_DELETE, SYNC_FILE_TYPE_UNKNOWN);
|
| + change = FileChange(FileChange::FILE_CHANGE_DELETE,
|
| + sync_file_system::SYNC_FILE_TYPE_UNKNOWN);
|
| EXPECT_EQ(SYNC_STATUS_OK,
|
| ApplyRemoteChange(file_system.file_system_context(),
|
| change, base::FilePath(), kDir,
|
| - SYNC_FILE_TYPE_DIRECTORY));
|
| + sync_file_system::SYNC_FILE_TYPE_DIRECTORY));
|
|
|
| // Check the directory/files are deleted successfully.
|
| EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
|
| @@ -537,11 +542,11 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) {
|
|
|
| // Apply the remote change to kFile1 (which will update the file).
|
| FileChange change(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
|
| - SYNC_FILE_TYPE_FILE);
|
| + sync_file_system::SYNC_FILE_TYPE_FILE);
|
| EXPECT_EQ(SYNC_STATUS_OK,
|
| ApplyRemoteChange(file_system.file_system_context(),
|
| change, kFilePath1, kFile1,
|
| - SYNC_FILE_TYPE_FILE));
|
| + sync_file_system::SYNC_FILE_TYPE_FILE));
|
|
|
| // Check if the usage has been increased by (kTestFileData1 - kTestFileData0).
|
| const int updated_size =
|
| @@ -553,29 +558,30 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) {
|
| // Apply remote changes to kFile2 and kDir (should create a file and
|
| // directory respectively).
|
| // They are non-existent yet so their expected file type (the last
|
| - // parameter of ApplyRemoteChange) are SYNC_FILE_TYPE_UNKNOWN.
|
| + // parameter of ApplyRemoteChange) are
|
| + // sync_file_system::SYNC_FILE_TYPE_UNKNOWN.
|
| change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
|
| - SYNC_FILE_TYPE_FILE);
|
| + sync_file_system::SYNC_FILE_TYPE_FILE);
|
| EXPECT_EQ(SYNC_STATUS_OK,
|
| ApplyRemoteChange(file_system.file_system_context(),
|
| change, kFilePath2, kFile2,
|
| - SYNC_FILE_TYPE_UNKNOWN));
|
| + sync_file_system::SYNC_FILE_TYPE_UNKNOWN));
|
|
|
| change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
|
| - SYNC_FILE_TYPE_DIRECTORY);
|
| + sync_file_system::SYNC_FILE_TYPE_DIRECTORY);
|
| EXPECT_EQ(SYNC_STATUS_OK,
|
| ApplyRemoteChange(file_system.file_system_context(),
|
| change, base::FilePath(), kDir,
|
| - SYNC_FILE_TYPE_UNKNOWN));
|
| + sync_file_system::SYNC_FILE_TYPE_UNKNOWN));
|
|
|
| // This should not happen, but calling ApplyRemoteChange
|
| // with wrong file type will result in error.
|
| change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
|
| - SYNC_FILE_TYPE_FILE);
|
| + sync_file_system::SYNC_FILE_TYPE_FILE);
|
| EXPECT_NE(SYNC_STATUS_OK,
|
| ApplyRemoteChange(file_system.file_system_context(),
|
| change, kFilePath1, kDir,
|
| - SYNC_FILE_TYPE_DIRECTORY));
|
| + sync_file_system::SYNC_FILE_TYPE_DIRECTORY));
|
|
|
| // Creating a file/directory must have increased the usage more than
|
| // the size of kTestFileData2.
|
|
|