This is a reland of commit e5f6f1434e.
The only difference is: disabling a test that conflicts with
the new implementation (see b/323984075).
Original change's description:
> Lacros testing: Make browser init param overriding more robust
>
> See chromium:1508245 for context.
>
> - Decide whether crosapi is enabled based on the command line
> switches. In particular, make it independent of when/whether
> BrowserTestBase::SetUp gets called.
> We still provide DisableCrosapiForTesting for legacy reasons,
> as some tests need to ovrerride it.
>
> - This, plus some new checks, make it hard for tests
> * to accidentally and silently override the Ash-provided init
> params with mostly empty ones, or
> * to accidentally and silently prevent the Ash-provided params
> from even being read.
>
> - Address a TODO in InProcessBrowserTest thanks to these changes.
>
> - Call DisableCrosapiForTesting in ViewsTestBase-derived tests that
> run with crosapi enabled but are not prepared to set it up (and thus
> would fail one of the new checks) and in fact don't need crosapi.
>
> - Remove InProcessBrowserTest::IsCrosapiEnabled() in favor of
> !chromeos::BrowserParamsProxy::IsCrosapiDisabledForTesting(). There
> is no need to have the InProcessBrowserTest predicate and it's not
> an InProcessBrowserTest level concept.
>
> - Remove ScopedDisableCrosapiForTesting class, as there is no need for
> a scope. Tests should either not call DisableCrosapiForTesting at
> all or should do it very early on (CHECK'd). Undoing it is not
> supported and it's not neceesary because tests run in separate
> processes.
>
> - Add documentation to startup/README.md.
>
> - Remove some uses of IsCrosapiDisabledForTesting from production code
> that are no longer needed.
>
> Bug: chromium:1508245
> Change-Id: Id6b68a25dae4c50132f957f4b80879fdcde2e7b2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5076190
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
> Commit-Queue: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1255430}
Bug: chromium:1508245, b/323984075
Change-Id: I8cced0fe121b3edb757aacc07a706205566cbf24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5267259
Auto-Submit: Georg Neis <neis@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1257372}