diff options
author | pvalenzuela <pvalenzuela@chromium.org> | 2015-06-26 16:56:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-26 23:57:12 +0000 |
commit | de1f200f5956bc57b066f902e72ede3b273a7af9 (patch) | |
tree | 9c15c9819c1d2a5f74d6e214152f328f7ac64b84 /sync/test/fake_server/fake_server_entity.h | |
parent | e6eae8d8a7f0a6311393a8a4c820460883986660 (diff) | |
download | chromium_src-de1f200f5956bc57b066f902e72ede3b273a7af9.zip chromium_src-de1f200f5956bc57b066f902e72ede3b273a7af9.tar.gz chromium_src-de1f200f5956bc57b066f902e72ede3b273a7af9.tar.bz2 |
Sync: add entity modification to FakeServer
This CL adds the ModifyEntity method to FakeServer. This method is used
to modify existing Sync data on the server-side in order to mimic the
commit of a different client. This CL also adds a desktop browser test,
DownloadModifiedBookmark, to make use of the feature.
Other changes in the CL:
1) Add two util methods to the Sync bookmarks test helper to count
bookmarks by URL. This is needed because FakeServer::ModifyEntity
does not currently handle top-level entity name changes.
2) Change the FakeServerEntity hierarchy so that its EntitySpecifics
member is stored as a protected field in the base class. This is done
so that the specifics can be modified as part of a FakeServer method.
BUG=365774
Review URL: https://codereview.chromium.org/1196023002
Cr-Commit-Position: refs/heads/master@{#336478}
Diffstat (limited to 'sync/test/fake_server/fake_server_entity.h')
-rw-r--r-- | sync/test/fake_server/fake_server_entity.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sync/test/fake_server/fake_server_entity.h b/sync/test/fake_server/fake_server_entity.h index 6c7b944..faf8347 100644 --- a/sync/test/fake_server/fake_server_entity.h +++ b/sync/test/fake_server/fake_server_entity.h @@ -36,6 +36,10 @@ class FakeServerEntity { void SetVersion(int64 version); const std::string& GetName() const; + // Replaces |specifics_| with |updated_specifics|. This method is meant to be + // used to mimic a client commit. + void SetSpecifics(const sync_pb::EntitySpecifics& updated_specifics); + // Common data items needed by server virtual std::string GetParentId() const = 0; virtual void SerializeAsProto(sync_pb::SyncEntity* proto) = 0; @@ -54,18 +58,21 @@ class FakeServerEntity { void SerializeBaseProtoFields(sync_pb::SyncEntity* sync_entity); - // The ModelType that categorizes this entity. - syncer::ModelType model_type_; - private: // The entity's ID. std::string id_; + // The ModelType that categorizes this entity. + syncer::ModelType model_type_; + // The version of this entity. int64 version_; // The name of the entity. std::string name_; + + // The EntitySpecifics for the entity. + sync_pb::EntitySpecifics specifics_; }; } // namespace fake_server |