Fix test: WebAppHelpers.Brave_IsValidWebAppUrl on origin builds (#35264)
The test asserts IsValidWebAppUrl(GURL("chrome://leo-ai")) returns true,
which relies on kInstallablePWAWebUIHosts containing "leo-ai". However,
kInstallablePWAWebUIHosts is only populated when BUILDFLAG(ENABLE_AI_CHAT)
is true. Origin builds set is_brave_origin_branded=true which sets
enable_ai_chat=false, so the hosts set is empty and the assertion fails.
Guard the test with #if BUILDFLAG(ENABLE_AI_CHAT) to match the production
code's guard in webui_url_constants.h.
Fixes https://github.com/brave/brave-browser/issues/53963
This commit is contained in:
@@ -3,12 +3,16 @@
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "brave/components/constants/webui_url_constants.h"
|
||||
|
||||
#include <chrome/browser/web_applications/web_app_helpers_unittest.cc>
|
||||
|
||||
namespace web_app {
|
||||
|
||||
#if BUILDFLAG(ENABLE_AI_CHAT)
|
||||
TEST(WebAppHelpers, Brave_IsValidWebAppUrl) {
|
||||
EXPECT_TRUE(IsValidWebAppUrl(GURL("chrome://leo-ai")));
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_AI_CHAT)
|
||||
|
||||
} // namespace web_app
|
||||
|
||||
Reference in New Issue
Block a user