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

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

Issue 2328393002: [Sync] Add a sanity integration test for USS. (Closed)
Patch Set: Rebase. Created 4 years, 3 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 "components/sync/test/fake_server/permanent_entity.h" 5 #include "components/sync/test/fake_server/permanent_entity.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 sync_pb::EntitySpecifics entity_specifics; 58 sync_pb::EntitySpecifics entity_specifics;
59 AddDefaultFieldValue(model_type, &entity_specifics); 59 AddDefaultFieldValue(model_type, &entity_specifics);
60 return std::unique_ptr<FakeServerEntity>(new PermanentEntity( 60 return std::unique_ptr<FakeServerEntity>(new PermanentEntity(
61 id, model_type, name, kRootParentTag, server_tag, entity_specifics)); 61 id, model_type, name, kRootParentTag, server_tag, entity_specifics));
62 } 62 }
63 63
64 // static 64 // static
65 std::unique_ptr<FakeServerEntity> PermanentEntity::CreateUpdatedNigoriEntity( 65 std::unique_ptr<FakeServerEntity> PermanentEntity::CreateUpdatedNigoriEntity(
66 const sync_pb::SyncEntity& client_entity, 66 const sync_pb::SyncEntity& client_entity,
67 const FakeServerEntity& current_server_entity) { 67 const FakeServerEntity& current_server_entity) {
68 ModelType model_type = current_server_entity.GetModelType(); 68 ModelType model_type = current_server_entity.model_type();
69 CHECK(model_type == syncer::NIGORI) << "This factory only supports NIGORI " 69 CHECK(model_type == syncer::NIGORI) << "This factory only supports NIGORI "
70 << "entities."; 70 << "entities.";
71 71
72 return base::WrapUnique<FakeServerEntity>(new PermanentEntity( 72 return base::WrapUnique<FakeServerEntity>(new PermanentEntity(
73 current_server_entity.GetId(), model_type, 73 current_server_entity.id(), model_type, current_server_entity.GetName(),
74 current_server_entity.GetName(), current_server_entity.GetParentId(), 74 current_server_entity.GetParentId(),
75 syncer::ModelTypeToRootTag(model_type), client_entity.specifics())); 75 syncer::ModelTypeToRootTag(model_type), client_entity.specifics()));
76 } 76 }
77 77
78 PermanentEntity::PermanentEntity(const string& id, 78 PermanentEntity::PermanentEntity(const string& id,
79 const ModelType& model_type, 79 const ModelType& model_type,
80 const string& name, 80 const string& name,
81 const string& parent_id, 81 const string& parent_id,
82 const string& server_defined_unique_tag, 82 const string& server_defined_unique_tag,
83 const sync_pb::EntitySpecifics& specifics) 83 const sync_pb::EntitySpecifics& specifics)
84 : FakeServerEntity(id, model_type, 0, name), 84 : FakeServerEntity(id, string(), model_type, 0, name),
85 server_defined_unique_tag_(server_defined_unique_tag), 85 server_defined_unique_tag_(server_defined_unique_tag),
86 parent_id_(parent_id) { 86 parent_id_(parent_id) {
87 SetSpecifics(specifics); 87 SetSpecifics(specifics);
88 } 88 }
89 89
90 bool PermanentEntity::RequiresParentId() const { 90 bool PermanentEntity::RequiresParentId() const {
91 return true; 91 return true;
92 } 92 }
93 93
94 string PermanentEntity::GetParentId() const { 94 string PermanentEntity::GetParentId() const {
95 return parent_id_; 95 return parent_id_;
96 } 96 }
97 97
98 void PermanentEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { 98 void PermanentEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const {
99 FakeServerEntity::SerializeBaseProtoFields(proto); 99 FakeServerEntity::SerializeBaseProtoFields(proto);
100 proto->set_server_defined_unique_tag(server_defined_unique_tag_); 100 proto->set_server_defined_unique_tag(server_defined_unique_tag_);
101 } 101 }
102 102
103 bool PermanentEntity::IsFolder() const { 103 bool PermanentEntity::IsFolder() const {
104 return true; 104 return true;
105 } 105 }
106 106
107 bool PermanentEntity::IsPermanent() const { 107 bool PermanentEntity::IsPermanent() const {
108 return true; 108 return true;
109 } 109 }
110 110
111 } // namespace fake_server 111 } // namespace fake_server
OLDNEW
« no previous file with comments | « components/sync/test/fake_server/fake_server_entity.cc ('k') | components/sync/test/fake_server/tombstone_entity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698