Commit 20451340 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[Sync::USSS] Rename Dis/Associate to Remove/Add in SyncedBookmarkTracker

Bug: 516866
Change-Id: Iceaaeee84acd899c63936f6a864c48f7cf1a45df
Reviewed-on: https://chromium-review.googlesource.com/1087956Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564825}
parent d32cf308
......@@ -283,7 +283,7 @@ void BookmarkModelTypeProcessor::ProcessRemoteCreate(
<< update_data.specifics.bookmark().url();
return;
}
bookmark_tracker_.Associate(update_data.id, bookmark_node);
bookmark_tracker_.Add(update_data.id, bookmark_node);
// TODO(crbug.com/516866): Update metadata (e.g. server version,
// specifics_hash).
}
......@@ -359,7 +359,7 @@ void BookmarkModelTypeProcessor::ProcessRemoteDelete(
}
bookmark_model_->Remove(node);
bookmark_tracker_.Disassociate(update_data.id);
bookmark_tracker_.Remove(update_data.id);
}
const bookmarks::BookmarkNode* BookmarkModelTypeProcessor::GetParentNode(
......@@ -386,7 +386,7 @@ void BookmarkModelTypeProcessor::AssociatePermanentFolder(
}
if (permanent_node != nullptr) {
bookmark_tracker_.Associate(update_data.id, permanent_node);
bookmark_tracker_.Add(update_data.id, permanent_node);
}
}
......
......@@ -38,13 +38,12 @@ const SyncedBookmarkTracker::Entity* SyncedBookmarkTracker::GetEntityForSyncId(
return it != sync_id_to_entities_map_.end() ? it->second.get() : nullptr;
}
void SyncedBookmarkTracker::Associate(
const std::string& sync_id,
const bookmarks::BookmarkNode* bookmark_node) {
void SyncedBookmarkTracker::Add(const std::string& sync_id,
const bookmarks::BookmarkNode* bookmark_node) {
sync_id_to_entities_map_[sync_id] = std::make_unique<Entity>(bookmark_node);
}
void SyncedBookmarkTracker::Disassociate(const std::string& sync_id) {
void SyncedBookmarkTracker::Remove(const std::string& sync_id) {
sync_id_to_entities_map_.erase(sync_id);
}
......
......@@ -58,14 +58,14 @@ class SyncedBookmarkTracker {
// Returns null if not entity is found.
const Entity* GetEntityForSyncId(const std::string& sync_id) const;
// Associates a server id with the corresponding local bookmark node in
// |sync_id_to_entities_map_|.
void Associate(const std::string& sync_id,
const bookmarks::BookmarkNode* bookmark_node);
// Adds an entry for the |sync_id| and the corresponding local bookmark node
// in |sync_id_to_entities_map_|.
void Add(const std::string& sync_id,
const bookmarks::BookmarkNode* bookmark_node);
// Removes the association that corresponds to |sync_id| from
// Removes the entry coressponding to the |sync_id| from
// |sync_id_to_entities_map_|.
void Disassociate(const std::string& sync_id);
void Remove(const std::string& sync_id);
// Returns number of tracked entities. Used only in test.
std::size_t TrackedEntitiesCountForTest() const;
......
......@@ -21,7 +21,7 @@ TEST(SyncedBookmarkTrackerTest, ShouldGetAssociatedNodes) {
const std::string kSyncId = "SYNC_ID";
const int64_t kId = 1;
bookmarks::BookmarkNode node(kId, GURL());
tracker.Associate(kSyncId, &node);
tracker.Add(kSyncId, &node);
const SyncedBookmarkTracker::Entity* entity =
tracker.GetEntityForSyncId(kSyncId);
ASSERT_THAT(entity, NotNull());
......@@ -34,9 +34,9 @@ TEST(SyncedBookmarkTrackerTest, ShouldReturnNullForDisassociatedNodes) {
const std::string kSyncId = "SYNC_ID";
const int64_t kId = 1;
bookmarks::BookmarkNode node(kId, GURL());
tracker.Associate(kSyncId, &node);
tracker.Add(kSyncId, &node);
ASSERT_THAT(tracker.GetEntityForSyncId(kSyncId), NotNull());
tracker.Disassociate(kSyncId);
tracker.Remove(kSyncId);
EXPECT_THAT(tracker.GetEntityForSyncId(kSyncId), IsNull());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment