Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Unified Diff: chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc

Issue 148283003: drive: Make sync performers aware of locally created files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/sync/remove_performer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
diff --git a/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc b/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
index caa1990f1e05deaff53200440305f0131a9fd7b3..4c6b8fd14e7f379a79eff0ca23d4c76dab5e7c17 100644
--- a/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
+++ b/chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc
@@ -4,8 +4,10 @@
#include "chrome/browser/chromeos/drive/sync/remove_performer.h"
+#include "base/task_runner_util.h"
#include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
+#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/drive/fake_drive_service.h"
#include "google_apis/drive/gdata_wapi_parser.h"
#include "google_apis/drive/test_util.h"
@@ -114,5 +116,35 @@ TEST_F(RemovePerformerTest, RemoveShared) {
EXPECT_FALSE(gdata_entry->GetLinkByType(google_apis::Link::LINK_PARENT));
}
+TEST_F(RemovePerformerTest, RemoveLocallyCreatedFile) {
+ RemovePerformer performer(blocking_task_runner(), observer(), scheduler(),
+ metadata());
+
+ // Add an entry without resource ID.
+ ResourceEntry entry;
+ entry.set_title("New File.txt");
+ entry.set_parent_local_id(util::kDriveTrashDirLocalId);
+
+ FileError error = FILE_ERROR_FAILED;
+ std::string local_id;
+ base::PostTaskAndReplyWithResult(
+ blocking_task_runner(),
+ FROM_HERE,
+ base::Bind(&ResourceMetadata::AddEntry,
+ base::Unretained(metadata()),
+ entry,
+ &local_id),
+ google_apis::test_util::CreateCopyResultCallback(&error));
+ test_util::RunBlockingPoolTask();
+ EXPECT_EQ(FILE_ERROR_OK, error);
+
+ // Remove the entry.
+ performer.Remove(local_id, ClientContext(USER_INITIATED),
+ google_apis::test_util::CreateCopyResultCallback(&error));
+ test_util::RunBlockingPoolTask();
+ EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntryById(local_id, &entry));
+}
+
} // namespace internal
} // namespace drive
« no previous file with comments | « chrome/browser/chromeos/drive/sync/remove_performer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698