| OLD | NEW |
| 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/bookmark_entity.h" | 5 #include "components/sync/test/fake_server/bookmark_entity.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/guid.h" | 11 #include "base/guid.h" |
| 12 #include "sync/internal_api/public/base/model_type.h" | 12 #include "components/sync/base/model_type.h" |
| 13 #include "sync/protocol/sync.pb.h" | 13 #include "components/sync/protocol/sync.pb.h" |
| 14 #include "sync/test/fake_server/fake_server_entity.h" | 14 #include "components/sync/test/fake_server/fake_server_entity.h" |
| 15 | 15 |
| 16 using std::string; | 16 using std::string; |
| 17 | 17 |
| 18 namespace fake_server { | 18 namespace fake_server { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Returns true if and only if |client_entity| is a bookmark. | 22 // Returns true if and only if |client_entity| is a bookmark. |
| 23 bool IsBookmark(const sync_pb::SyncEntity& client_entity) { | 23 bool IsBookmark(const sync_pb::SyncEntity& client_entity) { |
| 24 return syncer::GetModelType(client_entity) == syncer::BOOKMARKS; | 24 return syncer::GetModelType(client_entity) == syncer::BOOKMARKS; |
| 25 } | 25 } |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 BookmarkEntity::~BookmarkEntity() { } | 29 BookmarkEntity::~BookmarkEntity() {} |
| 30 | 30 |
| 31 // static | 31 // static |
| 32 std::unique_ptr<FakeServerEntity> BookmarkEntity::CreateNew( | 32 std::unique_ptr<FakeServerEntity> BookmarkEntity::CreateNew( |
| 33 const sync_pb::SyncEntity& client_entity, | 33 const sync_pb::SyncEntity& client_entity, |
| 34 const string& parent_id, | 34 const string& parent_id, |
| 35 const string& client_guid) { | 35 const string& client_guid) { |
| 36 CHECK(client_entity.version() == 0) << "New entities must have version = 0."; | 36 CHECK(client_entity.version() == 0) << "New entities must have version = 0."; |
| 37 CHECK(IsBookmark(client_entity)) << "The given entity must be a bookmark."; | 37 CHECK(IsBookmark(client_entity)) << "The given entity must be a bookmark."; |
| 38 | 38 |
| 39 const string id = | 39 const string id = |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 sync_pb::UniquePosition* unique_position = proto->mutable_unique_position(); | 119 sync_pb::UniquePosition* unique_position = proto->mutable_unique_position(); |
| 120 unique_position->CopyFrom(unique_position_); | 120 unique_position->CopyFrom(unique_position_); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool BookmarkEntity::IsFolder() const { | 123 bool BookmarkEntity::IsFolder() const { |
| 124 return is_folder_; | 124 return is_folder_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace fake_server | 127 } // namespace fake_server |
| OLD | NEW |