| Index: chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
|
| diff --git a/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc b/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
|
| index 678e7ce158e870f382ff64fa5ca707f759829959..5718f8f143aba9403d2bc50fa55ffb6f69480246 100644
|
| --- a/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
|
| +++ b/chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc
|
| @@ -550,5 +550,62 @@ TEST_F(EntryUpdatePerformerTest, UpdateEntry_CreateDirectory) {
|
| EXPECT_TRUE(server_entry->IsDirectory());
|
| }
|
|
|
| +TEST_F(EntryUpdatePerformerTest, ParentNeedsToBeSynced) {
|
| + // Create new directories locally.
|
| + const base::FilePath kPath(FILE_PATH_LITERAL("drive/root/New Directory"));
|
| + const base::FilePath kChildPath(
|
| + FILE_PATH_LITERAL("drive/root/New Directory/Sub Directory"));
|
| +
|
| + ResourceEntry parent;
|
| + EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kPath.DirName(), &parent));
|
| +
|
| + ResourceEntry entry;
|
| + entry.set_parent_local_id(parent.local_id());
|
| + entry.set_title(kPath.BaseName().AsUTF8Unsafe());
|
| + entry.mutable_file_info()->set_is_directory(true);
|
| + entry.set_metadata_edit_state(ResourceEntry::DIRTY);
|
| +
|
| + FileError error = FILE_ERROR_FAILED;
|
| + std::string local_id;
|
| + base::PostTaskAndReplyWithResult(
|
| + blocking_task_runner(),
|
| + FROM_HERE,
|
| + base::Bind(&internal::ResourceMetadata::AddEntry,
|
| + base::Unretained(metadata()),
|
| + entry,
|
| + &local_id),
|
| + google_apis::test_util::CreateCopyResultCallback(&error));
|
| + test_util::RunBlockingPoolTask();
|
| + EXPECT_EQ(FILE_ERROR_OK, error);
|
| +
|
| + ResourceEntry child;
|
| + child.set_parent_local_id(local_id);
|
| + child.set_title(kChildPath.BaseName().AsUTF8Unsafe());
|
| + child.mutable_file_info()->set_is_directory(true);
|
| + child.set_metadata_edit_state(ResourceEntry::DIRTY);
|
| +
|
| + error = FILE_ERROR_FAILED;
|
| + std::string child_local_id;
|
| + base::PostTaskAndReplyWithResult(
|
| + blocking_task_runner(),
|
| + FROM_HERE,
|
| + base::Bind(&internal::ResourceMetadata::AddEntry,
|
| + base::Unretained(metadata()),
|
| + child,
|
| + &child_local_id),
|
| + google_apis::test_util::CreateCopyResultCallback(&error));
|
| + test_util::RunBlockingPoolTask();
|
| + EXPECT_EQ(FILE_ERROR_OK, error);
|
| +
|
| + // Update the child. This should return a specific error code.
|
| + error = FILE_ERROR_FAILED;
|
| + performer_->UpdateEntry(
|
| + child_local_id,
|
| + ClientContext(USER_INITIATED),
|
| + google_apis::test_util::CreateCopyResultCallback(&error));
|
| + test_util::RunBlockingPoolTask();
|
| + EXPECT_EQ(FILE_ERROR_PARENT_NEEDS_TO_BE_SYNCED, error);
|
| +}
|
| +
|
| } // namespace internal
|
| } // namespace drive
|
|
|