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

Side by Side Diff: components/sync/test/fake_server/unique_client_entity.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/test/fake_server/unique_client_entity.h" 5 #include "components/sync/test/fake_server/unique_client_entity.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/guid.h" 12 #include "base/guid.h"
13 #include "sync/internal_api/public/base/model_type.h" 13 #include "components/sync/base/model_type.h"
14 #include "sync/protocol/sync.pb.h" 14 #include "components/sync/protocol/sync.pb.h"
15 #include "sync/syncable/syncable_util.h" 15 #include "components/sync/syncable/syncable_util.h"
16 #include "sync/test/fake_server/fake_server_entity.h" 16 #include "components/sync/test/fake_server/fake_server_entity.h"
17 #include "sync/test/fake_server/permanent_entity.h" 17 #include "components/sync/test/fake_server/permanent_entity.h"
18 18
19 using std::string; 19 using std::string;
20 20
21 using syncer::GetModelTypeFromSpecifics; 21 using syncer::GetModelTypeFromSpecifics;
22 using syncer::ModelType; 22 using syncer::ModelType;
23 using syncer::syncable::GenerateSyncableHash; 23 using syncer::syncable::GenerateSyncableHash;
24 24
25 namespace fake_server { 25 namespace fake_server {
26 26
27 namespace { 27 namespace {
(...skipping 16 matching lines...) Expand all
44 const sync_pb::EntitySpecifics& specifics, 44 const sync_pb::EntitySpecifics& specifics,
45 int64_t creation_time, 45 int64_t creation_time,
46 int64_t last_modified_time) 46 int64_t last_modified_time)
47 : FakeServerEntity(id, model_type, version, name), 47 : FakeServerEntity(id, model_type, version, name),
48 client_defined_unique_tag_(client_defined_unique_tag), 48 client_defined_unique_tag_(client_defined_unique_tag),
49 creation_time_(creation_time), 49 creation_time_(creation_time),
50 last_modified_time_(last_modified_time) { 50 last_modified_time_(last_modified_time) {
51 SetSpecifics(specifics); 51 SetSpecifics(specifics);
52 } 52 }
53 53
54 UniqueClientEntity::~UniqueClientEntity() { } 54 UniqueClientEntity::~UniqueClientEntity() {}
55 55
56 // static 56 // static
57 std::unique_ptr<FakeServerEntity> UniqueClientEntity::Create( 57 std::unique_ptr<FakeServerEntity> UniqueClientEntity::Create(
58 const sync_pb::SyncEntity& client_entity) { 58 const sync_pb::SyncEntity& client_entity) {
59 CHECK(client_entity.has_client_defined_unique_tag()) 59 CHECK(client_entity.has_client_defined_unique_tag())
60 << "A UniqueClientEntity must have a client-defined unique tag."; 60 << "A UniqueClientEntity must have a client-defined unique tag.";
61 ModelType model_type = 61 ModelType model_type =
62 syncer::GetModelTypeFromSpecifics(client_entity.specifics()); 62 syncer::GetModelTypeFromSpecifics(client_entity.specifics());
63 string id = EffectiveIdForClientTaggedEntity(client_entity); 63 string id = EffectiveIdForClientTaggedEntity(client_entity);
64 return std::unique_ptr<FakeServerEntity>(new UniqueClientEntity( 64 return std::unique_ptr<FakeServerEntity>(new UniqueClientEntity(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void UniqueClientEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { 100 void UniqueClientEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const {
101 FakeServerEntity::SerializeBaseProtoFields(proto); 101 FakeServerEntity::SerializeBaseProtoFields(proto);
102 102
103 proto->set_client_defined_unique_tag(client_defined_unique_tag_); 103 proto->set_client_defined_unique_tag(client_defined_unique_tag_);
104 proto->set_ctime(creation_time_); 104 proto->set_ctime(creation_time_);
105 proto->set_mtime(last_modified_time_); 105 proto->set_mtime(last_modified_time_);
106 } 106 }
107 107
108 } // namespace fake_server 108 } // namespace fake_server
OLDNEW
« no previous file with comments | « components/sync/test/fake_server/unique_client_entity.h ('k') | components/sync/test/fake_sync_encryption_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698