0
Files
src/content/app/android
danakj 4115ec7301 Move ContentMain() replacement code to BrowserTestBase.
BrowserTestBase decides to run ContentMain() or BrowserMain()
based on the OS. On Android it uses BrowserMain() instead. When
using BrowserMain() on Android, the test harness reimplements
some of ContentMain() before calling BrowserMain(). This is done
in the ContentBrowserTestSuite currently, but that can not be
shared with chrome browser tests, which inherit
ContentTestSuiteBase but not ContentBrowserTestSuite. To promote
code sharing and move the logic to the same place where the
ContentMain() decision is made, we move this setup code over
to BrowserTestBase.

While doing so, we update the code to more closely match what
ContentMain() does. This makes Android existing browser test
suites act more like desktop browser tests, which go through
ContentMain() already:
- Instead of hardcoding using ShellContentClient, we use the
ContentMainDelegate to create the ContentClient (which will be
a ShellContentClient in existing cases, but will differ in
chrome browser tests).
- Ordering is adjusted to match.
- The ContentMainDelegate is used and called throughout the
setup process the same way that ContentMain() would, including
calls to ShouldCreateFeatureList(), PostFieldTrialInitialization(),
PreCreateMainMessageLoop(), PostEarlyInitialization(),
PostTaskSchedulerStart(), and BasicStartupComplete().

Using the ContentMainDelegate doesn't change existing behaviour for
the most part though, as the ShellMainDelegate overrides largely set
up for web test mode, which browser tests do not run in (content shell
is run separately for that).

The InitMessagePumpForUIFactory() call from ContentBrowserTestSuite
must be made before the test suite is initialized, however, so it can
not move to BrowserTestBase. Instead we put it in the JNI_Onload method
of each browser test target. This ensures it is run first, and we
DCHECK that it succeeded.

In single process mode, we also must initialize a ContentRendererClient
which was being done in ContentBrowserTest, so moved this up to
the BrowserTestBase.

R=avi@chromium.org

Bug: 961849
Change-Id: Iefc105e3dc9f142774331aa97b0f1006bd701c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606424
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659128}
2019-05-13 18:34:22 +00:00
..