* Fix intermittent test BraveSearchTestEnabled.DefaultAPIVisibleKnownHost
The test was failing because the previous polling approach called
getCanSetDefaultSearchProvider() repeatedly in a loop, but each
call has side effects: it records an "ask" against a rate limit
(3 per day). After 3 calls, all subsequent calls return false,
causing the polling loop to time out.
The fix has two parts:
1. Wait for TemplateURLService to load in SetUpOnMainThread()
before setting Google as default. This ensures the keyword
lookup for :g succeeds reliably.
2. Replace the polling loop with base::test::RunUntil() that
checks in C++ whether a TemplateURL matching the allowed domain
exists and CanMakeDefault() returns true. Only then call the
JS API getCanSetDefaultSearchProvider() exactly once, avoiding
the rate limit exhaustion.
Resolves https://github.com/brave/brave-browser/issues/52439
* Fix BUILD.gn dep ordering