| 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/prefs/scoped_user_pref_update.h" | 5 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 7 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 8 #include "chrome/browser/translate/translate_prefs.h" | 8 #include "chrome/browser/translate/translate_prefs.h" |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // Phase 2: Modify a pref (to trigger migration) and wait for a sync | 49 // Phase 2: Modify a pref (to trigger migration) and wait for a sync |
| 50 // cycle. | 50 // cycle. |
| 51 // TODO(akalin): Shouldn't need to wait for full sync cycle; see | 51 // TODO(akalin): Shouldn't need to wait for full sync cycle; see |
| 52 // 93167. | 52 // 93167. |
| 53 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 53 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 54 ChangeBooleanPref(0, prefs::kShowHomeButton); | 54 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 55 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Migration")); | 55 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Migration")); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // TODO(akalin): Fails due to http://crbug.com/92928. | 58 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 59 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, FAILS_PrefsNigori) { | 59 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, DISABLED_PrefsNigori) { |
| 60 if (!ServerSupportsErrorTriggering()) { | 60 if (!ServerSupportsErrorTriggering()) { |
| 61 LOG(WARNING) << "Test skipped in this server environment."; | 61 LOG(WARNING) << "Test skipped in this server environment."; |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 DisableNotifications(); | 65 DisableNotifications(); |
| 66 | 66 |
| 67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 67 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 68 | 68 |
| 69 // Phase 1: Trigger a preference and nigori migration on the server. | 69 // Phase 1: Trigger a preference and nigori migration on the server. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 // Phase 2: Modify a pref (to trigger migration) and wait for a sync | 81 // Phase 2: Modify a pref (to trigger migration) and wait for a sync |
| 82 // cycle. | 82 // cycle. |
| 83 // TODO(akalin): Shouldn't need to wait for full sync cycle; see | 83 // TODO(akalin): Shouldn't need to wait for full sync cycle; see |
| 84 // 93167. | 84 // 93167. |
| 85 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 85 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 86 ChangeBooleanPref(0, prefs::kShowHomeButton); | 86 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 87 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Migration")); | 87 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Migration")); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // TODO(akalin): Fails due to http://crbug.com/92928. | 90 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 91 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, FAILS_BookmarksPrefs) { | 91 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, DISABLED_BookmarksPrefs) { |
| 92 if (!ServerSupportsErrorTriggering()) { | 92 if (!ServerSupportsErrorTriggering()) { |
| 93 LOG(WARNING) << "Test skipped in this server environment."; | 93 LOG(WARNING) << "Test skipped in this server environment."; |
| 94 return; | 94 return; |
| 95 } | 95 } |
| 96 | 96 |
| 97 DisableNotifications(); | 97 DisableNotifications(); |
| 98 | 98 |
| 99 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 99 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 100 | 100 |
| 101 // Phase 1: Trigger a bookmark and preference migration on the | 101 // Phase 1: Trigger a bookmark and preference migration on the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 126 public: | 126 public: |
| 127 MigrationErrorsTest() : LiveSyncTest(TWO_CLIENT) {} | 127 MigrationErrorsTest() : LiveSyncTest(TWO_CLIENT) {} |
| 128 virtual ~MigrationErrorsTest() {} | 128 virtual ~MigrationErrorsTest() {} |
| 129 | 129 |
| 130 private: | 130 private: |
| 131 DISALLOW_COPY_AND_ASSIGN(MigrationErrorsTest); | 131 DISALLOW_COPY_AND_ASSIGN(MigrationErrorsTest); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 // Easiest possible test of migration errors: triggers a server migration on | 134 // Easiest possible test of migration errors: triggers a server migration on |
| 135 // one datatype, then modifies some other datatype. | 135 // one datatype, then modifies some other datatype. |
| 136 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigratePrefsThenModifyBookmark) { | 136 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 137 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, |
| 138 DISABLED_MigratePrefsThenModifyBookmark) { |
| 137 if (!ServerSupportsErrorTriggering()) { | 139 if (!ServerSupportsErrorTriggering()) { |
| 138 LOG(WARNING) << "Test skipped in this server environment."; | 140 LOG(WARNING) << "Test skipped in this server environment."; |
| 139 return; | 141 return; |
| 140 } | 142 } |
| 141 | 143 |
| 142 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 144 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 143 | 145 |
| 144 // Phase 1: Before migrating anything, create & sync a preference. | 146 // Phase 1: Before migrating anything, create & sync a preference. |
| 145 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 147 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 146 ChangeBooleanPref(0, prefs::kShowHomeButton); | 148 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 158 | 160 |
| 159 // Phase 4: Verify that preferences can still be synchronized. | 161 // Phase 4: Verify that preferences can still be synchronized. |
| 160 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 162 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 161 ChangeBooleanPref(0, prefs::kShowHomeButton); | 163 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 162 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 164 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 163 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 165 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 164 } | 166 } |
| 165 | 167 |
| 166 // Triggers a server migration on two datatypes, then makes a local | 168 // Triggers a server migration on two datatypes, then makes a local |
| 167 // modification to one of them. | 169 // modification to one of them. |
| 170 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 168 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, | 171 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, |
| 169 MigratePrefsAndBookmarksThenModifyBookmark) { | 172 DISABLED_MigratePrefsAndBookmarksThenModifyBookmark) { |
| 170 if (!ServerSupportsErrorTriggering()) { | 173 if (!ServerSupportsErrorTriggering()) { |
| 171 LOG(WARNING) << "Test skipped in this server environment."; | 174 LOG(WARNING) << "Test skipped in this server environment."; |
| 172 return; | 175 return; |
| 173 } | 176 } |
| 174 | 177 |
| 175 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 178 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 176 | 179 |
| 177 // Phase 1: Before migrating anything, create & sync a preference. | 180 // Phase 1: Before migrating anything, create & sync a preference. |
| 178 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 181 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 179 ChangeBooleanPref(0, prefs::kShowHomeButton); | 182 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 192 | 195 |
| 193 // Phase 4: Verify that preferences can still be synchronized. | 196 // Phase 4: Verify that preferences can still be synchronized. |
| 194 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 197 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 195 ChangeBooleanPref(0, prefs::kShowHomeButton); | 198 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 196 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 199 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 197 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 200 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 198 } | 201 } |
| 199 | 202 |
| 200 // Migrate every datatype in sequence; the catch being that the server | 203 // Migrate every datatype in sequence; the catch being that the server |
| 201 // will only tell the client about the migrations one at a time. | 204 // will only tell the client about the migrations one at a time. |
| 202 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithoutNigori) { | 205 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 206 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, |
| 207 DISABLED_MigrationHellWithoutNigori) { |
| 203 if (!ServerSupportsErrorTriggering()) { | 208 if (!ServerSupportsErrorTriggering()) { |
| 204 LOG(WARNING) << "Test skipped in this server environment."; | 209 LOG(WARNING) << "Test skipped in this server environment."; |
| 205 return; | 210 return; |
| 206 } | 211 } |
| 207 | 212 |
| 208 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 213 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 209 | 214 |
| 210 // Phase 1: Before migrating anything, create & sync a preference. | 215 // Phase 1: Before migrating anything, create & sync a preference. |
| 211 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 216 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 212 ChangeBooleanPref(0, prefs::kShowHomeButton); | 217 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 232 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); | 237 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); |
| 233 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 238 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 234 | 239 |
| 235 // Phase 4: Verify that preferences can still be synchronized. | 240 // Phase 4: Verify that preferences can still be synchronized. |
| 236 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 241 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 237 ChangeBooleanPref(0, prefs::kShowHomeButton); | 242 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 238 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 243 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 239 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 244 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 240 } | 245 } |
| 241 | 246 |
| 242 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithNigori) { | 247 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 248 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, |
| 249 DISABLED_MigrationHellWithNigori) { |
| 243 if (!ServerSupportsErrorTriggering()) { | 250 if (!ServerSupportsErrorTriggering()) { |
| 244 LOG(WARNING) << "Test skipped in this server environment."; | 251 LOG(WARNING) << "Test skipped in this server environment."; |
| 245 return; | 252 return; |
| 246 } | 253 } |
| 247 | 254 |
| 248 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 255 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 249 | 256 |
| 250 // Phase 1: Before migrating anything, create & sync a preference. | 257 // Phase 1: Before migrating anything, create & sync a preference. |
| 251 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 258 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 252 ChangeBooleanPref(0, prefs::kShowHomeButton); | 259 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 329 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 323 ChangeBooleanPref(0, prefs::kShowHomeButton); | 330 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 324 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 331 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 325 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 332 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 326 | 333 |
| 327 // Phase 5: Verify that sessions are registered and enabled. | 334 // Phase 5: Verify that sessions are registered and enabled. |
| 328 ASSERT_TRUE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS)); | 335 ASSERT_TRUE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS)); |
| 329 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 336 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 330 } | 337 } |
| 331 | 338 |
| 332 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, SetSyncTabsAndMigrate) { | 339 // TODO(akalin): Fails (times out) due to http://crbug.com/92928. |
| 340 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, |
| 341 DISABLED_SetSyncTabsAndMigrate) { |
| 333 if (!ServerSupportsErrorTriggering()) { | 342 if (!ServerSupportsErrorTriggering()) { |
| 334 LOG(WARNING) << "Test skipped in this server environment."; | 343 LOG(WARNING) << "Test skipped in this server environment."; |
| 335 return; | 344 return; |
| 336 } | 345 } |
| 337 | 346 |
| 338 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 347 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 339 ASSERT_FALSE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS)); | 348 ASSERT_FALSE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS)); |
| 340 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 349 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 341 | 350 |
| 342 // Phase 1: Before migrating anything, create & sync a preference. | 351 // Phase 1: Before migrating anything, create & sync a preference. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 360 // Phase 5: Verify that preferences can still be synchronized. | 369 // Phase 5: Verify that preferences can still be synchronized. |
| 361 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 370 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 362 ChangeBooleanPref(0, prefs::kShowHomeButton); | 371 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 363 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 372 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 364 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 373 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 365 | 374 |
| 366 // Phase 6: Verify that sessions are registered and enabled. | 375 // Phase 6: Verify that sessions are registered and enabled. |
| 367 ASSERT_TRUE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS)); | 376 ASSERT_TRUE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS)); |
| 368 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 377 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 369 } | 378 } |
| OLD | NEW |