Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5039)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java

Issue 1118833002: [Sync] Test SCF control states and a regression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scf-test
Patch Set: Rebase. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
index 9d98f967c366b4e69c675bb2ec0c06ddcee7ef24..5e1450f6b68a37e89241f1712772e2cba174c2df 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/SyncCustomizationFragment.java
@@ -79,16 +79,18 @@ public class SyncCustomizationFragment extends PreferenceFragment implements
public static final String PREFERENCE_SYNC_RECENT_TABS = "sync_recent_tabs";
@VisibleForTesting
public static final String PREFERENCE_ENCRYPTION = "encryption";
+ @VisibleForTesting
+ public static final String PREF_SYNC_SWITCH = "sync_switch";
+ @VisibleForTesting
+ public static final String PREFERENCE_SYNC_MANAGE_DATA = "sync_manage_data";
public static final String ARGUMENT_ACCOUNT = "account";
private static final int ERROR_COLOR = Color.RED;
- @VisibleForTesting
- public static final String PREF_SYNC_SWITCH = "sync_switch";
- private static final String PREFERENCE_SYNC_MANAGE_DATA = "sync_manage_data";
private ChromeSwitchPreference mSyncSwitchPreference;
private AndroidSyncSettings mAndroidSyncSettings;
+ private boolean mIsSyncInitialized;
@VisibleForTesting
public static final String[] PREFS_TO_SAVE = {
@@ -120,6 +122,7 @@ public class SyncCustomizationFragment extends PreferenceFragment implements
Bundle savedInstanceState) {
mAndroidSyncSettings = AndroidSyncSettings.get(getActivity());
mProfileSyncService = ProfileSyncService.get(getActivity());
+ mIsSyncInitialized = mProfileSyncService.isSyncInitialized();
getActivity().setTitle(R.string.sign_in_sync);
@@ -223,6 +226,7 @@ public class SyncCustomizationFragment extends PreferenceFragment implements
@Override
public void onResume() {
super.onResume();
+ mIsSyncInitialized = mProfileSyncService.isSyncInitialized();
// This prevents sync from actually syncing until the dialog is closed.
mProfileSyncService.setSetupInProgress(true);
mProfileSyncService.addSyncStateChangedListener(this);
@@ -570,8 +574,12 @@ public class SyncCustomizationFragment extends PreferenceFragment implements
*/
@Override
public void syncStateChanged() {
- // Update all because Password syncability is also affected by the backend.
- updateSyncStateFromSwitch();
+ boolean wasSyncInitialized = mIsSyncInitialized;
+ mIsSyncInitialized = mProfileSyncService.isSyncInitialized();
+ if (mIsSyncInitialized != wasSyncInitialized) {
+ // Update all because Password syncability is also affected by the backend.
+ updateSyncStateFromSwitch();
+ }
}
/**
« no previous file with comments | « no previous file | chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncCustomizationFragmentTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698