OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(akalin): Rename this file to migration_test.cc. | 5 // TODO(akalin): Rename this file to migration_test.cc. |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 8 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/profile_sync_service_harness.h" | 10 #include "chrome/browser/sync/profile_sync_service_harness.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // AwaitQuiescence() will not succeed when notifications are disabled. We | 175 // AwaitQuiescence() will not succeed when notifications are disabled. We |
176 // can safely avoid calling it because we know that, in the single client | 176 // can safely avoid calling it because we know that, in the single client |
177 // case, there is no one else to wait for. | 177 // case, there is no one else to wait for. |
178 // | 178 // |
179 // TODO(rlarocque, 97780): Remove the if condition when the test harness | 179 // TODO(rlarocque, 97780): Remove the if condition when the test harness |
180 // supports calling AwaitQuiescence() when notifications are disabled. | 180 // supports calling AwaitQuiescence() when notifications are disabled. |
181 if (!do_test_without_notifications) { | 181 if (!do_test_without_notifications) { |
182 AwaitQuiescence(); | 182 AwaitQuiescence(); |
183 } | 183 } |
184 | 184 |
185 // Re-enable notifications if we disabled it. | 185 // TODO(rlarocque): It should be possible to re-enable notifications |
186 if (do_test_without_notifications) { | 186 // here, but doing so makes some windows tests flaky. |
187 EnableNotifications(); | |
188 } | |
189 } | 187 } |
190 | 188 |
191 private: | 189 private: |
192 DISALLOW_COPY_AND_ASSIGN(MigrationTest); | 190 DISALLOW_COPY_AND_ASSIGN(MigrationTest); |
193 }; | 191 }; |
194 | 192 |
195 class MigrationSingleClientTest : public MigrationTest { | 193 class MigrationSingleClientTest : public MigrationTest { |
196 public: | 194 public: |
197 MigrationSingleClientTest() : MigrationTest(SINGLE_CLIENT) {} | 195 MigrationSingleClientTest() : MigrationTest(SINGLE_CLIENT) {} |
198 virtual ~MigrationSingleClientTest() {} | 196 virtual ~MigrationSingleClientTest() {} |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 242 } |
245 | 243 |
246 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, BookmarksPrefsBoth) { | 244 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, BookmarksPrefsBoth) { |
247 RunSingleClientMigrationTest( | 245 RunSingleClientMigrationTest( |
248 MakeList(MakeSet(syncable::BOOKMARKS, syncable::PREFERENCES)), | 246 MakeList(MakeSet(syncable::BOOKMARKS, syncable::PREFERENCES)), |
249 MODIFY_BOOKMARK); | 247 MODIFY_BOOKMARK); |
250 } | 248 } |
251 | 249 |
252 // Two data types with one being nigori. | 250 // Two data types with one being nigori. |
253 | 251 |
| 252 // See crbug.com/124480. |
254 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, | 253 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, |
255 DISABLED_PrefsNigoriIndividiaully) { | 254 DISABLED_PrefsNigoriIndividiaully) { |
256 RunSingleClientMigrationTest( | 255 RunSingleClientMigrationTest( |
257 MakeList(syncable::PREFERENCES, syncable::NIGORI), | 256 MakeList(syncable::PREFERENCES, syncable::NIGORI), |
258 TRIGGER_NOTIFICATION); | 257 TRIGGER_NOTIFICATION); |
259 } | 258 } |
260 | 259 |
261 // TODO(rlarocque): Re-enable this test when crbug.com/122033 is fixed. | 260 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, PrefsNigoriBoth) { |
262 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, DISABLED_PrefsNigoriBoth) { | |
263 RunSingleClientMigrationTest( | 261 RunSingleClientMigrationTest( |
264 MakeList(MakeSet(syncable::PREFERENCES, syncable::NIGORI)), | 262 MakeList(MakeSet(syncable::PREFERENCES, syncable::NIGORI)), |
265 MODIFY_PREF); | 263 MODIFY_PREF); |
266 } | 264 } |
267 | 265 |
268 // The whole shebang -- all data types. | 266 // The whole shebang -- all data types. |
269 | 267 |
270 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, AllTypesIndividually) { | 268 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, AllTypesIndividually) { |
271 ASSERT_TRUE(SetupClients()); | 269 ASSERT_TRUE(SetupClients()); |
272 RunSingleClientMigrationTest(GetPreferredDataTypesList(), MODIFY_BOOKMARK); | 270 RunSingleClientMigrationTest(GetPreferredDataTypesList(), MODIFY_BOOKMARK); |
(...skipping 14 matching lines...) Expand all Loading... |
287 | 285 |
288 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, | 286 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, |
289 AllTypesAtOnceTriggerNotification) { | 287 AllTypesAtOnceTriggerNotification) { |
290 ASSERT_TRUE(SetupClients()); | 288 ASSERT_TRUE(SetupClients()); |
291 RunSingleClientMigrationTest(MakeList(GetPreferredDataTypes()), | 289 RunSingleClientMigrationTest(MakeList(GetPreferredDataTypes()), |
292 TRIGGER_NOTIFICATION); | 290 TRIGGER_NOTIFICATION); |
293 } | 291 } |
294 | 292 |
295 // All data types plus nigori. | 293 // All data types plus nigori. |
296 | 294 |
| 295 // See crbug.com/124480. |
297 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, | 296 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, |
298 DISABLED_AllTypesWithNigoriIndividually) { | 297 DISABLED_AllTypesWithNigoriIndividually) { |
299 ASSERT_TRUE(SetupClients()); | 298 ASSERT_TRUE(SetupClients()); |
300 MigrationList migration_list = GetPreferredDataTypesList(); | 299 MigrationList migration_list = GetPreferredDataTypesList(); |
301 migration_list.push_front(MakeSet(syncable::NIGORI)); | 300 migration_list.push_front(MakeSet(syncable::NIGORI)); |
302 RunSingleClientMigrationTest(migration_list, MODIFY_BOOKMARK); | 301 RunSingleClientMigrationTest(migration_list, MODIFY_BOOKMARK); |
303 } | 302 } |
304 | 303 |
305 // TODO(rlarocque): Re-enable this test when crbug.com/122033 is fixed. | |
306 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, | 304 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, |
307 DISABLED_AllTypesWithNigoriAtOnce) { | 305 AllTypesWithNigoriAtOnce) { |
308 ASSERT_TRUE(SetupClients()); | 306 ASSERT_TRUE(SetupClients()); |
309 syncable::ModelTypeSet all_types = GetPreferredDataTypes(); | 307 syncable::ModelTypeSet all_types = GetPreferredDataTypes(); |
310 all_types.Put(syncable::NIGORI); | 308 all_types.Put(syncable::NIGORI); |
311 RunSingleClientMigrationTest(MakeList(all_types), MODIFY_PREF); | 309 RunSingleClientMigrationTest(MakeList(all_types), MODIFY_PREF); |
312 } | 310 } |
313 | 311 |
314 class MigrationTwoClientTest : public MigrationTest { | 312 class MigrationTwoClientTest : public MigrationTest { |
315 public: | 313 public: |
316 MigrationTwoClientTest() : MigrationTest(TWO_CLIENT) {} | 314 MigrationTwoClientTest() : MigrationTest(TWO_CLIENT) {} |
317 virtual ~MigrationTwoClientTest() {} | 315 virtual ~MigrationTwoClientTest() {} |
(...skipping 20 matching lines...) Expand all Loading... |
338 | 336 |
339 // Make sure pref sync still works after running the migration | 337 // Make sure pref sync still works after running the migration |
340 // test. | 338 // test. |
341 VerifyPrefSync(); | 339 VerifyPrefSync(); |
342 } | 340 } |
343 | 341 |
344 private: | 342 private: |
345 DISALLOW_COPY_AND_ASSIGN(MigrationTwoClientTest); | 343 DISALLOW_COPY_AND_ASSIGN(MigrationTwoClientTest); |
346 }; | 344 }; |
347 | 345 |
348 #if defined(OS_MACOSX) | |
349 #define MAYBE_MigratePrefsThenModifyBookmark DISABLED_MigratePrefsThenModifyBook
mark | |
350 #else | |
351 #define MAYBE_MigratePrefsThenModifyBookmark MigratePrefsThenModifyBookmark | |
352 #endif | |
353 // Easiest possible test of migration errors: triggers a server | 346 // Easiest possible test of migration errors: triggers a server |
354 // migration on one datatype, then modifies some other datatype. | 347 // migration on one datatype, then modifies some other datatype. |
355 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, | 348 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, MigratePrefsThenModifyBookmark) { |
356 MAYBE_MigratePrefsThenModifyBookmark) { | |
357 RunTwoClientMigrationTest(MakeList(syncable::PREFERENCES), | 349 RunTwoClientMigrationTest(MakeList(syncable::PREFERENCES), |
358 MODIFY_BOOKMARK); | 350 MODIFY_BOOKMARK); |
359 } | 351 } |
360 | 352 |
361 // Triggers a server migration on two datatypes, then makes a local | 353 // Triggers a server migration on two datatypes, then makes a local |
362 // modification to one of them. | 354 // modification to one of them. |
363 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, | 355 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, |
364 MigratePrefsAndBookmarksThenModifyBookmark) { | 356 MigratePrefsAndBookmarksThenModifyBookmark) { |
365 RunTwoClientMigrationTest( | 357 RunTwoClientMigrationTest( |
366 MakeList(syncable::PREFERENCES, syncable::BOOKMARKS), | 358 MakeList(syncable::PREFERENCES, syncable::BOOKMARKS), |
367 MODIFY_BOOKMARK); | 359 MODIFY_BOOKMARK); |
368 } | 360 } |
369 | 361 |
370 // Migrate every datatype in sequence; the catch being that the server | 362 // Migrate every datatype in sequence; the catch being that the server |
371 // will only tell the client about the migrations one at a time. | 363 // will only tell the client about the migrations one at a time. |
372 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, MigrationHellWithoutNigori) { | 364 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, MigrationHellWithoutNigori) { |
373 ASSERT_TRUE(SetupClients()); | 365 ASSERT_TRUE(SetupClients()); |
374 MigrationList migration_list = GetPreferredDataTypesList(); | 366 MigrationList migration_list = GetPreferredDataTypesList(); |
375 // Let the first nudge be a datatype that's neither prefs nor | 367 // Let the first nudge be a datatype that's neither prefs nor |
376 // bookmarks. | 368 // bookmarks. |
377 migration_list.push_front(MakeSet(syncable::THEMES)); | 369 migration_list.push_front(MakeSet(syncable::THEMES)); |
378 RunTwoClientMigrationTest(migration_list, MODIFY_BOOKMARK); | 370 RunTwoClientMigrationTest(migration_list, MODIFY_BOOKMARK); |
379 } | 371 } |
380 | 372 |
381 // TODO(rlarocque) Re-enable this test when crbug.com/122033 is fixed. | 373 // See crbug.com/124480. |
382 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, | 374 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, |
383 DISABLED_MigrationHellWithNigori) { | 375 DISABLED_MigrationHellWithNigori) { |
384 ASSERT_TRUE(SetupClients()); | 376 ASSERT_TRUE(SetupClients()); |
385 MigrationList migration_list = GetPreferredDataTypesList(); | 377 MigrationList migration_list = GetPreferredDataTypesList(); |
386 // Let the first nudge be a datatype that's neither prefs nor | 378 // Let the first nudge be a datatype that's neither prefs nor |
387 // bookmarks. | 379 // bookmarks. |
388 migration_list.push_front(MakeSet(syncable::THEMES)); | 380 migration_list.push_front(MakeSet(syncable::THEMES)); |
389 // Pop off one so that we don't migrate all data types; the syncer | 381 // Pop off one so that we don't migrate all data types; the syncer |
390 // freaks out if we do that (see http://crbug.com/94882). | 382 // freaks out if we do that (see http://crbug.com/94882). |
391 ASSERT_GE(migration_list.size(), 2u); | 383 ASSERT_GE(migration_list.size(), 2u); |
(...skipping 10 matching lines...) Expand all Loading... |
402 AddTestSwitches(cl); | 394 AddTestSwitches(cl); |
403 // Do not add optional datatypes. | 395 // Do not add optional datatypes. |
404 } | 396 } |
405 | 397 |
406 virtual ~MigrationReconfigureTest() {} | 398 virtual ~MigrationReconfigureTest() {} |
407 | 399 |
408 private: | 400 private: |
409 DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest); | 401 DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest); |
410 }; | 402 }; |
411 | 403 |
412 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, DISABLED_SetSyncTabs) { | 404 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, |
| 405 DISABLED_SetSyncTabs) { |
413 if (!ServerSupportsErrorTriggering()) { | 406 if (!ServerSupportsErrorTriggering()) { |
414 LOG(WARNING) << "Test skipped in this server environment."; | 407 LOG(WARNING) << "Test skipped in this server environment."; |
415 return; | 408 return; |
416 } | 409 } |
417 | 410 |
418 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 411 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
419 ASSERT_FALSE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); | 412 ASSERT_FALSE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); |
420 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 413 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
421 | 414 |
422 // Phase 1: Before migrating anything, create & sync a preference. | 415 // Phase 1: Before migrating anything, create & sync a preference. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 452 |
460 // Phase 5: Verify that preferences can still be synchronized. | 453 // Phase 5: Verify that preferences can still be synchronized. |
461 VerifyPrefSync(); | 454 VerifyPrefSync(); |
462 | 455 |
463 // Phase 6: Verify that sessions are registered and enabled. | 456 // Phase 6: Verify that sessions are registered and enabled. |
464 ASSERT_TRUE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); | 457 ASSERT_TRUE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); |
465 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 458 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
466 } | 459 } |
467 | 460 |
468 } // namespace | 461 } // namespace |
OLD | NEW |