Chromium changes:
https://chromium.googlesource.com/chromium/src/+/e61a284712dafc93e2edc3d1f408e0721093ee89
Adapt SyncTestRule to allow AndroidSyncSettings to depend on PSS
Problem:
AndroidSyncSettings (ASS) will soon depend on ProfileSyncService (PSS),
particularly in its constructor. Although this is is fine in production
code, SyncTestRule poses two issues for this setup on test code.
- ASS is created before a fake PSS provided by tests can be injected.
This is a problem because the initial state of PSS will be relevant to
the constructor logic of ASS, so we need to be able to fake this initial
state to write good tests.
- ASS is created before the JNI loads in startMainActivityForSyncTest().
For tests that don't provide a fake PSS, ASS will then attempt to talk
to the real PSS before JNI is loaded, causing an error.
Solution:
When SyncTestRule creates an ASS, the goal is actually just to fake one
of its internal dependencies, SyncContentResolverDelegate. In this
CL, we convert SyncContentResolverDelegate into a singleton. In this way,
a fake for this object can be injected without needing to early construct
ASS*. Furthermore, JNI is loaded earlier so that the rule can safely use
tools like FakeServer and FakeProfileSyncService.
* Note that constructing after startMainActivityForSyncTest() is not an
option because there's already code talking to ASS when this function
is running.
Bug: 1125622
The patch is no longer needed as the Chromium change no longer creates a
new instalnce of AndroidSyncSettings in the testing c'tor (instead it
needs to be passed in).
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/7839b373c49781e224901e13b1c752c62053fe01
commit 7839b373c49781e224901e13b1c752c62053fe01
Author: Boris Sazonov <bsazonov@chromium.org>
Date: Fri Jul 10 09:16:51 2020 +0000
[Signin][Android] Ensure AndroidSyncSettings is created on the UI thread
Ensure AndroidSyncSettings.get() is only invoked on the UI thread. This
is necessary for migration to IdentityManager, as it can only be used
from the UI thread.
Bug: 1093998
Chromium change:
https://chromium.googlesource.com/chromium/src/+/0ddc774501addfbafeee70ff5f30a276f869d7bb
commit 0ddc774501addfbafeee70ff5f30a276f869d7bb
Author: Boris Sazonov <bsazonov@chromium.org>
Date: Thu Jun 25 17:15:49 2020 +0000
[Android] Move AndroidSyncSettings to org.chromium.chrome.browser.sync
Moves AndroidSyncSettings from org.chromium.components.sync to
org.chromium.chrome.browser.sync. There are several reasons for this
move:
1. AndroidSyncSettings is a singleton that interacts with Android sync
settings, so it is better suited for browser/sync.
2. AndroidSyncSettings interacts with ChromeSigninController that is
going to be removed in favor of IdentityManager.
Bug: 1093998