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

Unified Diff: sync/test/fake_server/fake_server.cc

Issue 1232003003: [Sync] Add bookmark move tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmark-folders
Patch Set: Use a couple existing JNI methods instead. Created 5 years, 5 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 | « sync/test/fake_server/fake_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/test/fake_server/fake_server.cc
diff --git a/sync/test/fake_server/fake_server.cc b/sync/test/fake_server/fake_server.cc
index 187912e5e3afef4e7c8d6e013032410ebff4421d..9a464578c3ca33d15bab81c8c819fd5aa89e775b 100644
--- a/sync/test/fake_server/fake_server.cc
+++ b/sync/test/fake_server/fake_server.cc
@@ -556,6 +556,27 @@ bool FakeServer::ModifyEntitySpecifics(
scoped_ptr<FakeServerEntity> entity = entities_.take_and_erase(iter);
entity->SetSpecifics(updated_specifics);
+ UpdateEntityVersion(entity.get());
+ entities_.insert(id, entity.Pass());
+ return true;
+}
+
+bool FakeServer::ModifyBookmarkEntity(
+ const std::string& id,
+ const std::string& parent_id,
+ const sync_pb::EntitySpecifics& updated_specifics) {
+ EntityMap::const_iterator iter = entities_.find(id);
+ if (iter == entities_.end() ||
+ iter->second->GetModelType() != syncer::BOOKMARKS ||
+ GetModelTypeFromSpecifics(updated_specifics) != syncer::BOOKMARKS) {
+ return false;
+ }
+
+ scoped_ptr<BookmarkEntity> entity(
+ static_cast<BookmarkEntity*>(entities_.take_and_erase(iter).release()));
+
+ entity->SetParentId(parent_id);
+ entity->SetSpecifics(updated_specifics);
if (updated_specifics.has_bookmark()) {
entity->SetName(updated_specifics.bookmark().title());
}
« no previous file with comments | « sync/test/fake_server/fake_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698