| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/bookmarks/bookmark_model.h" | 5 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 6 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 6 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 9 #include "chrome/browser/translate/translate_prefs.h" | 9 #include "chrome/browser/translate/translate_prefs.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 11 #include "chrome/test/live_sync/live_preferences_sync_test.h" | 11 #include "chrome/test/live_sync/live_sync_test.h" |
| 12 #include "chrome/test/live_sync/preferences_helper.h" |
| 12 #include "chrome/test/ui_test_utils.h" | 13 #include "chrome/test/ui_test_utils.h" |
| 13 | 14 |
| 14 // TODO(nick): In this file, we want to test multiple datatypes, but the test | 15 // TODO(rsimha): This class only uses PreferencesHelper. Make it use |
| 15 // framework only allows us access to the helper methods of whichever parent | 16 // BookmarksHelper too. |
| 16 // class we pick. We should move away from inheritance, and make this a | 17 class MigrationErrorsTest : public LiveSyncTest { |
| 17 // TwoClientLiveSyncTest that uses methods currently found in PreferencesSync | 18 public: |
| 18 // and BookmarksSync code. We ought to be able to check for profile equality | 19 MigrationErrorsTest() : LiveSyncTest(TWO_CLIENT) { |
| 19 // on all datatypes. | 20 PreferencesHelper::AssociateWithTest(this); |
| 20 class MigrationErrorsTest : public TwoClientLivePreferencesSyncTest { | 21 } |
| 22 virtual ~MigrationErrorsTest() {} |
| 21 | 23 |
| 24 private: |
| 25 DISALLOW_COPY_AND_ASSIGN(MigrationErrorsTest); |
| 22 }; | 26 }; |
| 23 | 27 |
| 24 // Easiest possible test of migration errors: triggers a server migration on | 28 // Easiest possible test of migration errors: triggers a server migration on |
| 25 // one datatype, then modifies some other datatype. | 29 // one datatype, then modifies some other datatype. |
| 26 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigratePrefsThenModifyBookmark) { | 30 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigratePrefsThenModifyBookmark) { |
| 27 if (!ServerSupportsErrorTriggering()) { | 31 if (!ServerSupportsErrorTriggering()) { |
| 28 LOG(WARNING) << "Test skipped in this server environment."; | 32 LOG(WARNING) << "Test skipped in this server environment."; |
| 29 return; | 33 return; |
| 30 } | 34 } |
| 31 | 35 |
| 32 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 36 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 33 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton), | |
| 34 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 35 | 37 |
| 36 // Phase 1: Before migrating anything, create & sync a preference. | 38 // Phase 1: Before migrating anything, create & sync a preference. |
| 37 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( | 39 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 38 prefs::kShowHomeButton); | 40 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 39 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 41 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 40 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 42 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 41 ASSERT_TRUE(AwaitQuiescence()); | 43 ASSERT_TRUE(AwaitQuiescence()); |
| 42 | 44 |
| 43 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 44 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 45 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 46 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 47 | |
| 48 // Phase 2: Trigger a preference migration on the server. | 45 // Phase 2: Trigger a preference migration on the server. |
| 49 syncable::ModelTypeSet migrate_types; | 46 syncable::ModelTypeSet migrate_types; |
| 50 migrate_types.insert(syncable::PREFERENCES); | 47 migrate_types.insert(syncable::PREFERENCES); |
| 51 TriggerMigrationDoneError(migrate_types); | 48 TriggerMigrationDoneError(migrate_types); |
| 52 | 49 |
| 53 // Phase 3: Modify a bookmark and await quiescence. | 50 // Phase 3: Modify a bookmark and await quiescence. |
| 54 Profile* p = GetProfile(0); | 51 Profile* p = GetProfile(0); |
| 55 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), | 52 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), |
| 56 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); | 53 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); |
| 57 | 54 |
| 58 ASSERT_TRUE(AwaitQuiescence()); | 55 ASSERT_TRUE(AwaitQuiescence()); |
| 59 | 56 |
| 60 // Phase 4: Verify that preferences can still be synchronized. | 57 // Phase 4: Verify that preferences can still be synchronized. |
| 61 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 58 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 62 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | 59 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 63 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 60 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 64 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | 61 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 65 | |
| 66 new_kShowHomeButton = !new_kShowHomeButton; | |
| 67 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 68 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 69 ASSERT_TRUE(AwaitQuiescence()); | |
| 70 | |
| 71 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 72 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 73 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 74 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 75 } | 62 } |
| 76 | 63 |
| 77 // Triggers a server migration on two datatypes, then makes a local | 64 // Triggers a server migration on two datatypes, then makes a local |
| 78 // modification to one of them. | 65 // modification to one of them. |
| 79 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, | 66 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, |
| 80 MigratePrefsAndBookmarksThenModifyBookmark) { | 67 MigratePrefsAndBookmarksThenModifyBookmark) { |
| 81 if (!ServerSupportsErrorTriggering()) { | 68 if (!ServerSupportsErrorTriggering()) { |
| 82 LOG(WARNING) << "Test skipped in this server environment."; | 69 LOG(WARNING) << "Test skipped in this server environment."; |
| 83 return; | 70 return; |
| 84 } | 71 } |
| 85 | 72 |
| 86 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 73 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 87 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton), | |
| 88 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 89 | 74 |
| 90 // Phase 1: Before migrating anything, create & sync a preference. | 75 // Phase 1: Before migrating anything, create & sync a preference. |
| 91 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( | 76 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 92 prefs::kShowHomeButton); | 77 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 93 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 78 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 94 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 79 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 95 ASSERT_TRUE(AwaitQuiescence()); | 80 ASSERT_TRUE(AwaitQuiescence()); |
| 96 | 81 |
| 97 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 98 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 99 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 100 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 101 | |
| 102 // Phase 2: Trigger a migration on the server. | 82 // Phase 2: Trigger a migration on the server. |
| 103 syncable::ModelTypeSet migrate_types; | 83 syncable::ModelTypeSet migrate_types; |
| 104 migrate_types.insert(syncable::PREFERENCES); | 84 migrate_types.insert(syncable::PREFERENCES); |
| 105 migrate_types.insert(syncable::BOOKMARKS); | 85 migrate_types.insert(syncable::BOOKMARKS); |
| 106 TriggerMigrationDoneError(migrate_types); | 86 TriggerMigrationDoneError(migrate_types); |
| 107 | 87 |
| 108 // Phase 3: Modify a bookmark and await quiescence. | 88 // Phase 3: Modify a bookmark and await quiescence. |
| 109 Profile* p = GetProfile(0); | 89 Profile* p = GetProfile(0); |
| 110 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), | 90 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), |
| 111 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); | 91 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); |
| 112 ASSERT_TRUE(AwaitQuiescence()); | 92 ASSERT_TRUE(AwaitQuiescence()); |
| 113 | 93 |
| 114 // Phase 4: Verify that preferences can still be synchronized. | 94 // Phase 4: Verify that preferences can still be synchronized. |
| 115 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 95 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 116 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | 96 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 117 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 97 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 118 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | 98 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 119 | |
| 120 new_kShowHomeButton = !new_kShowHomeButton; | |
| 121 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 122 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 123 ASSERT_TRUE(AwaitQuiescence()); | |
| 124 | |
| 125 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 126 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 127 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 128 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 129 } | 99 } |
| 130 | 100 |
| 131 // Migrate every datatype in sequence; the catch being that the server | 101 // Migrate every datatype in sequence; the catch being that the server |
| 132 // will only tell the client about the migrations one at a time. | 102 // will only tell the client about the migrations one at a time. |
| 133 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithoutNigori) { | 103 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithoutNigori) { |
| 134 if (!ServerSupportsErrorTriggering()) { | 104 if (!ServerSupportsErrorTriggering()) { |
| 135 LOG(WARNING) << "Test skipped in this server environment."; | 105 LOG(WARNING) << "Test skipped in this server environment."; |
| 136 return; | 106 return; |
| 137 } | 107 } |
| 138 | 108 |
| 139 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 109 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 140 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton), | |
| 141 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 142 | 110 |
| 143 // Phase 1: Before migrating anything, create & sync a preference. | 111 // Phase 1: Before migrating anything, create & sync a preference. |
| 144 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( | 112 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 145 prefs::kShowHomeButton); | 113 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 146 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 114 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 147 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 115 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 148 ASSERT_TRUE(AwaitQuiescence()); | 116 ASSERT_TRUE(AwaitQuiescence()); |
| 149 | 117 |
| 150 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 151 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 152 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 153 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 154 | |
| 155 // Phase 2: Queue up a horrendous number of migrations on the server. | 118 // Phase 2: Queue up a horrendous number of migrations on the server. |
| 156 // Let the first nudge be a datatype that's neither prefs nor bookmarks. | 119 // Let the first nudge be a datatype that's neither prefs nor bookmarks. |
| 157 syncable::ModelTypeSet migrate_themes; | 120 syncable::ModelTypeSet migrate_themes; |
| 158 migrate_themes.insert(syncable::THEMES); | 121 migrate_themes.insert(syncable::THEMES); |
| 159 TriggerMigrationDoneError(migrate_themes); | 122 TriggerMigrationDoneError(migrate_themes); |
| 160 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; | 123 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; |
| 161 ++i) { | 124 ++i) { |
| 162 if (i == syncable::NIGORI) { | 125 if (i == syncable::NIGORI) { |
| 163 continue; | 126 continue; |
| 164 } | 127 } |
| 165 syncable::ModelTypeSet migrate_types; | 128 syncable::ModelTypeSet migrate_types; |
| 166 migrate_types.insert(syncable::ModelTypeFromInt(i)); | 129 migrate_types.insert(syncable::ModelTypeFromInt(i)); |
| 167 TriggerMigrationDoneError(migrate_types); | 130 TriggerMigrationDoneError(migrate_types); |
| 168 } | 131 } |
| 169 | 132 |
| 170 // Phase 3: Modify a bookmark and await quiescence. | 133 // Phase 3: Modify a bookmark and await quiescence. |
| 171 Profile* p = GetProfile(0); | 134 Profile* p = GetProfile(0); |
| 172 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), | 135 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), |
| 173 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); | 136 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); |
| 174 | 137 |
| 175 ASSERT_TRUE(AwaitQuiescence()); | 138 ASSERT_TRUE(AwaitQuiescence()); |
| 176 | 139 |
| 177 // Phase 4: Verify that preferences can still be synchronized. | 140 // Phase 4: Verify that preferences can still be synchronized. |
| 178 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 141 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 179 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | 142 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 180 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 143 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 181 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | 144 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 182 | |
| 183 new_kShowHomeButton = !new_kShowHomeButton; | |
| 184 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 185 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 186 ASSERT_TRUE(AwaitQuiescence()); | |
| 187 | |
| 188 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 189 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 190 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 191 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 192 } | 145 } |
| 193 | 146 |
| 194 // Fails because the client doesn't know how to not sync NIGORI. | 147 // Fails because the client doesn't know how to not sync NIGORI. |
| 195 // TODO(timsteele): Fix http://crbug.com/80333 and re-enable. | 148 // TODO(timsteele): Fix http://crbug.com/80333 and re-enable. |
| 196 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, | 149 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithNigori) { |
| 197 MigrationHellWithNigori) { | |
| 198 if (!ServerSupportsErrorTriggering()) { | 150 if (!ServerSupportsErrorTriggering()) { |
| 199 LOG(WARNING) << "Test skipped in this server environment."; | 151 LOG(WARNING) << "Test skipped in this server environment."; |
| 200 return; | 152 return; |
| 201 } | 153 } |
| 202 | 154 |
| 203 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 155 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 204 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton), | |
| 205 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 206 | 156 |
| 207 // Phase 1: Before migrating anything, create & sync a preference. | 157 // Phase 1: Before migrating anything, create & sync a preference. |
| 208 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( | 158 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 209 prefs::kShowHomeButton); | 159 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 210 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 160 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 211 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | 161 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 212 ASSERT_TRUE(AwaitQuiescence()); | 162 ASSERT_TRUE(AwaitQuiescence()); |
| 213 | 163 |
| 214 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 215 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 216 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 217 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 218 | |
| 219 // Phase 2: Queue up a horrendous number of migrations on the server. | 164 // Phase 2: Queue up a horrendous number of migrations on the server. |
| 220 // Let the first nudge be a datatype that's neither prefs nor bookmarks. | 165 // Let the first nudge be a datatype that's neither prefs nor bookmarks. |
| 221 syncable::ModelTypeSet migrate_themes; | 166 syncable::ModelTypeSet migrate_themes; |
| 222 migrate_themes.insert(syncable::THEMES); | 167 migrate_themes.insert(syncable::THEMES); |
| 223 TriggerMigrationDoneError(migrate_themes); | 168 TriggerMigrationDoneError(migrate_themes); |
| 224 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; | 169 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; |
| 225 ++i) { | 170 ++i) { |
| 226 // TODO(lipalani): If all types are disabled syncer freaks out. Fix it. | 171 // TODO(lipalani): If all types are disabled syncer freaks out. Fix it. |
| 227 if (i == syncable::BOOKMARKS) { | 172 if (i == syncable::BOOKMARKS) { |
| 228 continue; | 173 continue; |
| 229 } | 174 } |
| 230 syncable::ModelTypeSet migrate_types; | 175 syncable::ModelTypeSet migrate_types; |
| 231 migrate_types.insert(syncable::ModelTypeFromInt(i)); | 176 migrate_types.insert(syncable::ModelTypeFromInt(i)); |
| 232 TriggerMigrationDoneError(migrate_types); | 177 TriggerMigrationDoneError(migrate_types); |
| 233 } | 178 } |
| 234 | 179 |
| 235 // Phase 3: modify a bookmark and wait for quiescence. | 180 // Phase 3: modify a bookmark and wait for quiescence. |
| 236 Profile* p = GetProfile(0); | 181 Profile* p = GetProfile(0); |
| 237 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), | 182 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), |
| 238 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); | 183 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); |
| 239 | 184 |
| 240 ASSERT_TRUE(AwaitQuiescence()); | 185 ASSERT_TRUE(AwaitQuiescence()); |
| 241 | 186 |
| 242 // Phase 4: Verify that preferences can still be synchronized. | 187 // Phase 4: Verify that preferences can still be synchronized. |
| 243 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 188 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 244 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | 189 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 245 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | 190 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 246 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | 191 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton)); |
| 247 | |
| 248 new_kShowHomeButton = !new_kShowHomeButton; | |
| 249 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 250 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); | |
| 251 ASSERT_TRUE(AwaitQuiescence()); | |
| 252 | |
| 253 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 254 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); | |
| 255 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), | |
| 256 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); | |
| 257 } | 192 } |
| 258 | |
| OLD | NEW |