Skip to content

Commit

Permalink
[Android][Sync] Add unit test for setting and resetting custom sync s…
Browse files Browse the repository at this point in the history
…ervice URL
  • Loading branch information
jagadeshjai authored and brave-browser-releases committed Dec 19, 2024
1 parent 58b66f3 commit 0df9396
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions components/sync/service/brave_sync_service_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,31 @@ TEST_F(BraveSyncServiceImplTest, NoLeaveDetailsWhenInitializeIOS) {
EXPECT_FALSE(brave_sync_prefs()->GetLeaveChainDetails().empty());
}

TEST_F(BraveSyncServiceImplTest, SetsAndResetsCustomSyncServiceUrl) {
CreateSyncService();

// Ensure the default sync service URL is set
GURL default_service_url =
brave_sync_service_impl()->GetBraveSyncServiceURL();
EXPECT_FALSE(default_service_url.is_empty());

// Set a custom sync service URL
GURL custom_sync_url("https://sync.example.com/v2");
EXPECT_TRUE(brave_sync_service_impl()->SetCustomSyncServiceURL(
custom_sync_url.spec()));

// Verify that the custom URL is set correctly
EXPECT_EQ(brave_sync_service_impl()->GetBraveSyncServiceURL(),
custom_sync_url);

// Reset to the default sync service URL
EXPECT_TRUE(brave_sync_service_impl()->SetCustomSyncServiceURL(""));

// Verify that the sync service URL is reset to the default
EXPECT_EQ(brave_sync_service_impl()->GetBraveSyncServiceURL(),
default_service_url);
}

namespace {
enum class GACookiesMethodType {
kOnAccountsCookieDeletedByUserAction,
Expand Down

0 comments on commit 0df9396

Please sign in to comment.