Skip to content

Commit 3b13b36

Browse files
Test for prevent duplication of brave-sync metainfo in bookmarks on copying
1 parent 9ae140a commit 3b13b36

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

components/brave_sync/brave_sync_service_unittest.cc

+31
Original file line numberDiff line numberDiff line change
@@ -1600,3 +1600,34 @@ TEST_F(BraveSyncServiceTest, CheckOtherBookmarkChildRecord) {
16001600
sync_service()->CheckOtherBookmarkChildRecord(record_a1.get());
16011601
EXPECT_EQ(record_a1->GetBookmark().parentFolderObjectId, object_id_iter1);
16021602
}
1603+
1604+
TEST_F(BraveSyncServiceTest, AddNonClonedBookmarkKeys) {
1605+
sync_service()->AddNonClonedBookmarkKeys(model());
1606+
const bookmarks::BookmarkNode* bookmark_a1 =
1607+
model()->AddURL(model()->other_node(), 0, base::ASCIIToUTF16("A1"),
1608+
GURL("https://a1.com"));
1609+
1610+
AsMutable(bookmark_a1)->SetMetaInfo("object_id", "object_id_value");
1611+
AsMutable(bookmark_a1)->SetMetaInfo("order", "order_value");
1612+
AsMutable(bookmark_a1)->SetMetaInfo("sync_timestamp", "sync_timestamp_value");
1613+
AsMutable(bookmark_a1)->SetMetaInfo("version", "version_value");
1614+
1615+
model()->Copy(bookmark_a1, model()->other_node(), 1);
1616+
1617+
const bookmarks::BookmarkNode* bookmark_copy =
1618+
model()->other_node()->children().at(1).get();
1619+
1620+
std::string meta_object_id;
1621+
EXPECT_FALSE(bookmark_copy->GetMetaInfo("object_id", &meta_object_id));
1622+
EXPECT_TRUE(meta_object_id.empty());
1623+
std::string meta_order;
1624+
EXPECT_FALSE(bookmark_copy->GetMetaInfo("order", &meta_order));
1625+
EXPECT_TRUE(meta_order.empty());
1626+
std::string meta_sync_timestamp;
1627+
EXPECT_FALSE(
1628+
bookmark_copy->GetMetaInfo("sync_timestamp", &meta_sync_timestamp));
1629+
EXPECT_TRUE(meta_sync_timestamp.empty());
1630+
std::string meta_version;
1631+
EXPECT_FALSE(bookmark_copy->GetMetaInfo("version", &meta_version));
1632+
EXPECT_TRUE(meta_version.empty());
1633+
}

0 commit comments

Comments
 (0)