[Sync] Ensure isSyncable is set when signed in.
commitfd45731d49e2274221be3df2bd2fb3c8b0bed613
authormaxbogue <maxbogue@chromium.org>
Tue, 21 Apr 2015 21:22:08 +0000 (21 14:22 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 21 Apr 2015 21:22:16 +0000 (21 21:22 +0000)
tree296281ee2fe182af2f786d092a3163fa0a3cf1f5
parent3af9f401d955a957527d0a913736e48dcacb67a7
[Sync] Ensure isSyncable is set when signed in.

This is a more extensive version of http://crrev.com/1075343003 for
landing on trunk.

Previously, if isSyncable is false, but sync is enabled for Chrome,
even if you sign in, Chrome would never set syncable to true.

This CL ensures that syncable is always set to true if there is an
account signed in, regardless of whether chrome sync is enabled or not.

Additionally, it sets syncable to false when no account is signed in,
to ensure that the user does not see a non-functional switch in the
Android settings.

The new AccountManager setup in the test is necessary so that the test accounts can be cleaned up by the loop in updateSyncability().

BUG=475299
TEST=Regression tests added, plus:
Ensure that
$ adb shell dumpsys content | grep chrome
should show syncable=0 and enabled=true
Sign in to Chrome. Now dumpsys should say syncable=1 and enabled=true.

Review URL: https://codereview.chromium.org/1062973004

Cr-Commit-Position: refs/heads/master@{#326122}
sync/android/java/src/org/chromium/sync/AndroidSyncSettings.java
sync/android/javatests/src/org/chromium/sync/AndroidSyncSettingsTest.java
sync/test/android/javatests/src/org/chromium/sync/test/util/MockSyncContentResolverDelegate.java