[Sync] Test SCF control states and a regression
Four new tests for SyncCustomizationFragment:
- SCF state is correct starting from sync on and transitioning to off.
- SCF state is correct starting from sync off and transitioning to on.
- SCF's data type controls respond correctly to the sync everything switch.
- SCF opening and closing does not start sync.
In order to prevent flakiness, this CL makes some additional changes.
- Remove MockAccountManager.postAsyncAccountChangedEvent().
Justification: we have no control about when Android performs
the callback from it. The callback coming in at weird points
during other test cases was making tests flaky. Testing mechanisms
should be predictable.
- SCF now caches the backend initialized state in order to filter
syncStateChanged() calls down to only changes to that state.
BUG=480604
Review URL: https://codereview.chromium.org/
1118833002
Cr-Commit-Position: refs/heads/master@{#329740}