[Sync] Test SCF control states and a regression
commita465d93b75f40e550a6362c5639d78c6c14b9642
authormaxbogue <maxbogue@chromium.org>
Wed, 13 May 2015 22:43:43 +0000 (13 15:43 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 13 May 2015 22:44:55 +0000 (13 22:44 +0000)
treece0f507ce3be0718a0b555ff10f26f0145276886
parent71b7554b14c1ef97e8d4c487ab357b5dcef891dc
[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}
chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java
chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java