diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index d28d6dc65664..8a4273c68b4e 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -151,6 +151,9 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { command_line.AppendSwitch(switches::kDisableDatabases); + // Disable sync temporarily + command_line.AppendSwitch(switches::kDisableSync); + // Enabled features. const std::unordered_set enabled_features = { password_manager::features::kPasswordImport.name, diff --git a/browser/brave_content_browser_client_browsertest.cc b/browser/brave_content_browser_client_browsertest.cc index a8185f8cd2de..f897f8ecc679 100644 --- a/browser/brave_content_browser_client_browsertest.cc +++ b/browser/brave_content_browser_client_browsertest.cc @@ -27,6 +27,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/prefs/pref_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "content/public/browser/navigation_entry.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_navigation_observer.h" @@ -154,10 +155,11 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, CanLoadCustomBravePages) { #if BUILDFLAG(BRAVE_REWARDS_ENABLED) "rewards", #endif + }; #if BUILDFLAG(ENABLE_BRAVE_SYNC) - chrome::kChromeUISyncHost, + if (switches::IsSyncAllowedByFlag()) + pages.push_back(chrome::kChromeUISyncHost); #endif - }; std::vector schemes { "brave://", @@ -221,7 +223,10 @@ IN_PROC_BROWSER_TEST_F(BraveContentBrowserClientTest, browser()->tab_strip_model()->GetActiveWebContents(); ui_test_utils::NavigateToURL( browser(), GURL(scheme + chrome::kChromeUISyncInternalsHost)); - ASSERT_TRUE(WaitForLoadStop(contents)); + if (switches::IsSyncAllowedByFlag()) + ASSERT_TRUE(WaitForLoadStop(contents)); + else + ASSERT_FALSE(WaitForLoadStop(contents)); EXPECT_STREQ(base::UTF16ToUTF8(browser()->location_bar_model() ->GetFormattedFullURL()).c_str(), diff --git a/browser/ui/brave_browser_command_controller_browsertest.cc b/browser/ui/brave_browser_command_controller_browsertest.cc index 778d2297b296..aaeeaf2766f3 100644 --- a/browser/ui/brave_browser_command_controller_browsertest.cc +++ b/browser/ui/brave_browser_command_controller_browsertest.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/test/base/in_process_browser_test.h" +#include "components/sync/driver/sync_driver_switches.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" @@ -53,7 +54,10 @@ IN_PROC_BROWSER_TEST_F(BraveBrowserCommandControllerTest, #endif #if BUILDFLAG(ENABLE_BRAVE_SYNC) - EXPECT_TRUE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); + if (switches::IsSyncAllowedByFlag()) + EXPECT_TRUE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); + else + EXPECT_FALSE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); #else EXPECT_FALSE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); #endif @@ -86,7 +90,10 @@ IN_PROC_BROWSER_TEST_F(BraveBrowserCommandControllerTest, #endif #if BUILDFLAG(ENABLE_BRAVE_SYNC) - EXPECT_TRUE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); + if (switches::IsSyncAllowedByFlag()) + EXPECT_TRUE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); + else + EXPECT_FALSE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); #endif #if BUILDFLAG(BRAVE_WALLET_ENABLED) @@ -171,7 +178,10 @@ IN_PROC_BROWSER_TEST_F(BraveBrowserCommandControllerTest, #endif #if BUILDFLAG(ENABLE_BRAVE_SYNC) - EXPECT_TRUE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); + if (switches::IsSyncAllowedByFlag()) + EXPECT_TRUE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); + else + EXPECT_FALSE(command_controller->IsCommandEnabled(IDC_SHOW_BRAVE_SYNC)); #endif #if BUILDFLAG(BRAVE_WALLET_ENABLED) diff --git a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc index 41af60d884ca..2eb93b8e80bf 100644 --- a/browser/ui/toolbar/brave_app_menu_model_browsertest.cc +++ b/browser/ui/toolbar/brave_app_menu_model_browsertest.cc @@ -23,6 +23,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/test/base/in_process_browser_test.h" +#include "components/sync/driver/sync_driver_switches.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_utils.h" @@ -88,6 +89,16 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuBrowserTest, MenuOrderTest) { std::vector commands_disabled_for_normal_profile = { IDC_NEW_TOR_CONNECTION_FOR_SITE, }; +#if BUILDFLAG(ENABLE_BRAVE_SYNC) + if (!switches::IsSyncAllowedByFlag()) { + commands_in_order_for_normal_profile.erase( + std::remove(commands_in_order_for_normal_profile.begin(), + commands_in_order_for_normal_profile.end(), + IDC_SHOW_BRAVE_SYNC), + commands_in_order_for_normal_profile.end()); + commands_disabled_for_normal_profile.push_back(IDC_SHOW_BRAVE_SYNC); + } +#endif CheckCommandsAreInOrderInMenuModel(browser(), commands_in_order_for_normal_profile); CheckCommandsAreDisabledInMenuModel(browser(), @@ -122,6 +133,16 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuBrowserTest, MenuOrderTest) { IDC_NEW_TOR_CONNECTION_FOR_SITE, IDC_RECENT_TABS_MENU, }; +#if BUILDFLAG(ENABLE_BRAVE_SYNC) + if (!switches::IsSyncAllowedByFlag()) { + commands_in_order_for_private_profile.erase( + std::remove(commands_in_order_for_private_profile.begin(), + commands_in_order_for_private_profile.end(), + IDC_SHOW_BRAVE_SYNC), + commands_in_order_for_private_profile.end()); + commands_disabled_for_private_profile.push_back(IDC_SHOW_BRAVE_SYNC); + } +#endif CheckCommandsAreInOrderInMenuModel(private_browser, commands_in_order_for_private_profile); CheckCommandsAreDisabledInMenuModel(private_browser, @@ -215,6 +236,16 @@ IN_PROC_BROWSER_TEST_F(BraveAppMenuBrowserTest, MenuOrderTest) { std::vector commands_disabled_for_tor_profile = { IDC_RECENT_TABS_MENU, }; +#if BUILDFLAG(ENABLE_BRAVE_SYNC) + if (!switches::IsSyncAllowedByFlag()) { + commands_in_order_for_tor_profile.erase( + std::remove(commands_in_order_for_tor_profile.begin(), + commands_in_order_for_tor_profile.end(), + IDC_SHOW_BRAVE_SYNC), + commands_in_order_for_tor_profile.end()); + commands_disabled_for_tor_profile.push_back(IDC_SHOW_BRAVE_SYNC); + } +#endif CheckCommandsAreInOrderInMenuModel(tor_browser, commands_in_order_for_tor_profile); CheckCommandsAreDisabledInMenuModel(tor_browser,