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

Unified Diff: chrome/browser/drive/fake_drive_service.cc

Issue 17589004: FakeDriveService::DeleteResource should keep deleted entry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: listing deleted resources Created 7 years, 6 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 | « no previous file | chrome/browser/drive/fake_drive_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/drive/fake_drive_service.cc
diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc
index 3df7ba8abe4bd364a99d1af92c56a3079a7f0d2f..2e9805ee013720e6ae537409f30ea27784e893aa 100644
--- a/chrome/browser/drive/fake_drive_service.cc
+++ b/chrome/browser/drive/fake_drive_service.cc
@@ -35,6 +35,7 @@ using google_apis::EntryActionCallback;
using google_apis::GDataErrorCode;
using google_apis::GDATA_FILE_ERROR;
using google_apis::GDATA_NO_CONNECTION;
+using google_apis::GDATA_OTHER_ERROR;
using google_apis::GetAboutResourceCallback;
using google_apis::GetAppListCallback;
using google_apis::GetContentCallback;
@@ -528,16 +529,21 @@ CancelCallback FakeDriveService::DeleteResource(
if (entries->GetDictionary(i, &entry) &&
entry->GetString("gd$resourceId.$t", &current_resource_id) &&
resource_id == current_resource_id) {
- entries->Remove(i, NULL);
+ GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ if (entry->HasKey("gd$deleted")) {
+ error = HTTP_NOT_FOUND;
+ } else {
+ entry->Set("gd$deleted", new DictionaryValue);
+ AddNewChangestampAndETag(entry);
+ error = HTTP_SUCCESS;
+ }
base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(callback, HTTP_SUCCESS));
+ FROM_HERE, base::Bind(callback, error));
return CancelCallback();
}
}
}
- // TODO(satorux): Add support for returning "deleted" entries in
- // changelists from GetResourceList().
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, HTTP_NOT_FOUND));
return CancelCallback();
@@ -1413,6 +1419,11 @@ void FakeDriveService::GetResourceListInternal(
if (start_changestamp > 0 && entry->changestamp() < start_changestamp)
should_exclude = true;
+ // If the caller requests other list than change list by specifying
+ // zero-|start_changestamp|, exclude deleted entry from the result.
+ if (!start_changestamp && entry->deleted())
+ should_exclude = true;
+
// The entry matched the criteria for inclusion.
if (!should_exclude)
++num_entries_matched;
« no previous file with comments | « no previous file | chrome/browser/drive/fake_drive_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698