Skip to content

Commit

Permalink
Add tests for Virtual "Other Bookmarks" mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Feb 6, 2020
1 parent e556675 commit 8b8f4e3
Show file tree
Hide file tree
Showing 7 changed files with 389 additions and 19 deletions.
5 changes: 4 additions & 1 deletion components/brave_sync/brave_profile_sync_service_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -805,12 +805,15 @@ void BraveProfileSyncServiceImpl::LoadSyncEntityInfo(

bool BraveProfileSyncServiceImpl::IsOtherBookmarksFolder(
const jslib::SyncRecord* record) const {
auto bookmark = record->GetBookmark();
if (!bookmark.isFolder)
return false;

std::string other_node_object_id;
if (model_->other_node()->GetMetaInfo("object_id", &other_node_object_id) &&
record->objectId == other_node_object_id)
return true;

auto bookmark = record->GetBookmark();
if (bookmark.order == tools::kOtherNodeOrder &&
bookmark.site.title == tools::GetOtherNodeName() &&
bookmark.site.customTitle == tools::GetOtherNodeName()) {
Expand Down
15 changes: 15 additions & 0 deletions components/brave_sync/brave_profile_sync_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ FORWARD_DECLARE_TEST(BraveSyncServiceTest, SetThisDeviceCreatedTime);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, InitialFetchesStartWithZero);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, DeviceIdV2Migration);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, DeviceIdV2MigrationDupDeviceId);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, IsOtherBookmarksFolder);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, ProcessOtherBookmarksFolder);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, ProcessOtherBookmarksChildren);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, CheckOtherBookmarkRecord);
FORWARD_DECLARE_TEST(BraveSyncServiceTest, CheckOtherBookmarkChildRecord);

class BraveSyncServiceTest;

Expand Down Expand Up @@ -168,6 +173,16 @@ class BraveProfileSyncServiceImpl
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest, DeviceIdV2Migration);
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest,
DeviceIdV2MigrationDupDeviceId);
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest,
IsOtherBookmarksFolder);
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest,
ProcessOtherBookmarksFolder);
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest,
ProcessOtherBookmarksChildren);
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest,
CheckOtherBookmarkRecord);
FRIEND_TEST_ALL_PREFIXES(::BraveSyncServiceTest,
CheckOtherBookmarkChildRecord);

friend class ::BraveSyncServiceTest;

Expand Down
Loading

0 comments on commit 8b8f4e3

Please sign in to comment.