Skip to content

Commit

Permalink
Test for prevent duplication of brave-sync metainfo in bookmarks on c…
Browse files Browse the repository at this point in the history
…opying
  • Loading branch information
AlexeyBarabash committed Feb 21, 2020
1 parent 9ae140a commit 3b13b36
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions components/brave_sync/brave_sync_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1600,3 +1600,34 @@ TEST_F(BraveSyncServiceTest, CheckOtherBookmarkChildRecord) {
sync_service()->CheckOtherBookmarkChildRecord(record_a1.get());
EXPECT_EQ(record_a1->GetBookmark().parentFolderObjectId, object_id_iter1);
}

TEST_F(BraveSyncServiceTest, AddNonClonedBookmarkKeys) {
sync_service()->AddNonClonedBookmarkKeys(model());
const bookmarks::BookmarkNode* bookmark_a1 =
model()->AddURL(model()->other_node(), 0, base::ASCIIToUTF16("A1"),
GURL("https://a1.com"));

AsMutable(bookmark_a1)->SetMetaInfo("object_id", "object_id_value");
AsMutable(bookmark_a1)->SetMetaInfo("order", "order_value");
AsMutable(bookmark_a1)->SetMetaInfo("sync_timestamp", "sync_timestamp_value");
AsMutable(bookmark_a1)->SetMetaInfo("version", "version_value");

model()->Copy(bookmark_a1, model()->other_node(), 1);

const bookmarks::BookmarkNode* bookmark_copy =
model()->other_node()->children().at(1).get();

std::string meta_object_id;
EXPECT_FALSE(bookmark_copy->GetMetaInfo("object_id", &meta_object_id));
EXPECT_TRUE(meta_object_id.empty());
std::string meta_order;
EXPECT_FALSE(bookmark_copy->GetMetaInfo("order", &meta_order));
EXPECT_TRUE(meta_order.empty());
std::string meta_sync_timestamp;
EXPECT_FALSE(
bookmark_copy->GetMetaInfo("sync_timestamp", &meta_sync_timestamp));
EXPECT_TRUE(meta_sync_timestamp.empty());
std::string meta_version;
EXPECT_FALSE(bookmark_copy->GetMetaInfo("version", &meta_version));
EXPECT_TRUE(meta_version.empty());
}

0 comments on commit 3b13b36

Please sign in to comment.