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

Side by Side Diff: chrome/browser/sync/test/integration/migration_test.cc

Issue 387763002: sync: Re-enable some migration integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/status_change_checker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/prefs/scoped_user_pref_update.h" 7 #include "base/prefs/scoped_user_pref_update.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/backend_migrator.h" 9 #include "chrome/browser/sync/backend_migrator.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // types. 236 // types.
237 void AwaitMigration(syncer::ModelTypeSet migrate_types) { 237 void AwaitMigration(syncer::ModelTypeSet migrate_types) {
238 for (int i = 0; i < num_clients(); ++i) { 238 for (int i = 0; i < num_clients(); ++i) {
239 MigrationChecker* checker = migration_checkers_[i]; 239 MigrationChecker* checker = migration_checkers_[i];
240 checker->set_expected_types(migrate_types); 240 checker->set_expected_types(migrate_types);
241 checker->Wait(); 241 checker->Wait();
242 ASSERT_FALSE(checker->TimedOut()); 242 ASSERT_FALSE(checker->TimedOut());
243 } 243 }
244 } 244 }
245 245
246 bool ShouldRunMigrationTest() const {
247 if (!ServerSupportsNotificationControl() ||
248 !ServerSupportsErrorTriggering()) {
249 LOG(WARNING) << "Test skipped in this server environment.";
250 return false;
251 }
252 return true;
253 }
254
255 // Makes sure migration works with the given migration list and 246 // Makes sure migration works with the given migration list and
256 // trigger method. 247 // trigger method.
257 void RunMigrationTest(const MigrationList& migration_list, 248 void RunMigrationTest(const MigrationList& migration_list,
258 TriggerMethod trigger_method) { 249 TriggerMethod trigger_method) {
259 ASSERT_TRUE(ShouldRunMigrationTest());
260
261 // If we have only one client, turn off notifications to avoid the 250 // If we have only one client, turn off notifications to avoid the
262 // possibility of spurious sync cycles. 251 // possibility of spurious sync cycles.
263 bool do_test_without_notifications = 252 bool do_test_without_notifications =
264 (trigger_method != TRIGGER_NOTIFICATION && num_clients() == 1); 253 (trigger_method != TRIGGER_NOTIFICATION && num_clients() == 1);
265 254
266 if (do_test_without_notifications) { 255 if (do_test_without_notifications) {
267 DisableNotifications(); 256 DisableNotifications();
268 } 257 }
269 258
270 // Make sure migration hasn't been triggered prematurely. 259 // Make sure migration hasn't been triggered prematurely.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 295
307 private: 296 private:
308 // Used to keep track of the migration progress for each sync client. 297 // Used to keep track of the migration progress for each sync client.
309 ScopedVector<MigrationChecker> migration_checkers_; 298 ScopedVector<MigrationChecker> migration_checkers_;
310 299
311 DISALLOW_COPY_AND_ASSIGN(MigrationTest); 300 DISALLOW_COPY_AND_ASSIGN(MigrationTest);
312 }; 301 };
313 302
314 class MigrationSingleClientTest : public MigrationTest { 303 class MigrationSingleClientTest : public MigrationTest {
315 public: 304 public:
316 MigrationSingleClientTest() : MigrationTest(SINGLE_CLIENT) {} 305 MigrationSingleClientTest() : MigrationTest(SINGLE_CLIENT_LEGACY) {}
317 virtual ~MigrationSingleClientTest() {} 306 virtual ~MigrationSingleClientTest() {}
318 307
319 void RunSingleClientMigrationTest(const MigrationList& migration_list, 308 void RunSingleClientMigrationTest(const MigrationList& migration_list,
320 TriggerMethod trigger_method) { 309 TriggerMethod trigger_method) {
321 if (!ShouldRunMigrationTest()) {
322 return;
323 }
324 ASSERT_TRUE(SetupSync()); 310 ASSERT_TRUE(SetupSync());
325 RunMigrationTest(migration_list, trigger_method); 311 RunMigrationTest(migration_list, trigger_method);
326 } 312 }
327 313
328 private: 314 private:
329 DISALLOW_COPY_AND_ASSIGN(MigrationSingleClientTest); 315 DISALLOW_COPY_AND_ASSIGN(MigrationSingleClientTest);
330 }; 316 };
331 317
332 // The simplest possible migration tests -- a single data type. 318 // The simplest possible migration tests -- a single data type.
333 319
(...skipping 14 matching lines...) Expand all
348 334
349 // Nigori is handled specially, so we test that separately. 335 // Nigori is handled specially, so we test that separately.
350 336
351 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, NigoriOnly) { 337 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, NigoriOnly) {
352 RunSingleClientMigrationTest(MakeList(syncer::PREFERENCES), 338 RunSingleClientMigrationTest(MakeList(syncer::PREFERENCES),
353 TRIGGER_NOTIFICATION); 339 TRIGGER_NOTIFICATION);
354 } 340 }
355 341
356 // A little more complicated -- two data types. 342 // A little more complicated -- two data types.
357 343
344 // See crbug.com/392989.
358 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, 345 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
359 BookmarksPrefsIndividually) { 346 DISABLED_BookmarksPrefsIndividually) {
360 RunSingleClientMigrationTest( 347 RunSingleClientMigrationTest(
361 MakeList(syncer::BOOKMARKS, syncer::PREFERENCES), 348 MakeList(syncer::BOOKMARKS, syncer::PREFERENCES),
362 MODIFY_PREF); 349 MODIFY_PREF);
363 } 350 }
364 351
365 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, BookmarksPrefsBoth) { 352 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, BookmarksPrefsBoth) {
366 RunSingleClientMigrationTest( 353 RunSingleClientMigrationTest(
367 MakeList(MakeSet(syncer::BOOKMARKS, syncer::PREFERENCES)), 354 MakeList(MakeSet(syncer::BOOKMARKS, syncer::PREFERENCES)),
368 MODIFY_BOOKMARK); 355 MODIFY_BOOKMARK);
369 } 356 }
370 357
371 // Two data types with one being nigori. 358 // Two data types with one being nigori.
372 359
373 // See crbug.com/124480. 360 // See crbug.com/124480.
374 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, 361 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
375 DISABLED_PrefsNigoriIndividiaully) { 362 DISABLED_PrefsNigoriIndividiaully) {
376 RunSingleClientMigrationTest( 363 RunSingleClientMigrationTest(
377 MakeList(syncer::PREFERENCES, syncer::NIGORI), 364 MakeList(syncer::PREFERENCES, syncer::NIGORI),
378 TRIGGER_NOTIFICATION); 365 TRIGGER_NOTIFICATION);
379 } 366 }
380 367
381 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, PrefsNigoriBoth) { 368 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, PrefsNigoriBoth) {
382 RunSingleClientMigrationTest( 369 RunSingleClientMigrationTest(
383 MakeList(MakeSet(syncer::PREFERENCES, syncer::NIGORI)), 370 MakeList(MakeSet(syncer::PREFERENCES, syncer::NIGORI)),
384 MODIFY_PREF); 371 MODIFY_PREF);
385 } 372 }
386 373
387 // The whole shebang -- all data types. 374 // The whole shebang -- all data types.
388 375
389 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, AllTypesIndividually) { 376 // See crbug.com/392989.
377 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
378 DISABLED_AllTypesIndividually) {
390 ASSERT_TRUE(SetupClients()); 379 ASSERT_TRUE(SetupClients());
391 RunSingleClientMigrationTest(GetPreferredDataTypesList(), MODIFY_BOOKMARK); 380 RunSingleClientMigrationTest(GetPreferredDataTypesList(), MODIFY_BOOKMARK);
392 } 381 }
393 382
383 // See crbug.com/392989.
394 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, 384 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
395 AllTypesIndividuallyTriggerNotification) { 385 DISABLED_AllTypesIndividuallyTriggerNotification) {
396 ASSERT_TRUE(SetupClients()); 386 ASSERT_TRUE(SetupClients());
397 RunSingleClientMigrationTest(GetPreferredDataTypesList(), 387 RunSingleClientMigrationTest(GetPreferredDataTypesList(),
398 TRIGGER_NOTIFICATION); 388 TRIGGER_NOTIFICATION);
399 } 389 }
400 390
401 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, AllTypesAtOnce) { 391 // See crbug.com/392989.
392 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, DISABLED_AllTypesAtOnce) {
402 ASSERT_TRUE(SetupClients()); 393 ASSERT_TRUE(SetupClients());
403 RunSingleClientMigrationTest(MakeList(GetPreferredDataTypes()), 394 RunSingleClientMigrationTest(MakeList(GetPreferredDataTypes()),
404 MODIFY_PREF); 395 MODIFY_PREF);
405 } 396 }
406 397
398 // See crbug.com/392989.
407 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, 399 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
408 AllTypesAtOnceTriggerNotification) { 400 DISABLED_AllTypesAtOnceTriggerNotification) {
409 ASSERT_TRUE(SetupClients()); 401 ASSERT_TRUE(SetupClients());
410 RunSingleClientMigrationTest(MakeList(GetPreferredDataTypes()), 402 RunSingleClientMigrationTest(MakeList(GetPreferredDataTypes()),
411 TRIGGER_NOTIFICATION); 403 TRIGGER_NOTIFICATION);
412 } 404 }
413 405
414 // All data types plus nigori. 406 // All data types plus nigori.
415 407
416 // See crbug.com/124480. 408 // See crbug.com/124480.
417 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, 409 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
418 DISABLED_AllTypesWithNigoriIndividually) { 410 DISABLED_AllTypesWithNigoriIndividually) {
419 ASSERT_TRUE(SetupClients()); 411 ASSERT_TRUE(SetupClients());
420 MigrationList migration_list = GetPreferredDataTypesList(); 412 MigrationList migration_list = GetPreferredDataTypesList();
421 migration_list.push_front(MakeSet(syncer::NIGORI)); 413 migration_list.push_front(MakeSet(syncer::NIGORI));
422 RunSingleClientMigrationTest(migration_list, MODIFY_BOOKMARK); 414 RunSingleClientMigrationTest(migration_list, MODIFY_BOOKMARK);
423 } 415 }
424 416
417 // See crbug.com/392989.
425 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest, 418 IN_PROC_BROWSER_TEST_F(MigrationSingleClientTest,
426 AllTypesWithNigoriAtOnce) { 419 DISABLED_AllTypesWithNigoriAtOnce) {
427 ASSERT_TRUE(SetupClients()); 420 ASSERT_TRUE(SetupClients());
428 syncer::ModelTypeSet all_types = GetPreferredDataTypes(); 421 syncer::ModelTypeSet all_types = GetPreferredDataTypes();
429 all_types.Put(syncer::NIGORI); 422 all_types.Put(syncer::NIGORI);
430 RunSingleClientMigrationTest(MakeList(all_types), MODIFY_PREF); 423 RunSingleClientMigrationTest(MakeList(all_types), MODIFY_PREF);
431 } 424 }
432 425
433 class MigrationTwoClientTest : public MigrationTest { 426 class MigrationTwoClientTest : public MigrationTest {
434 public: 427 public:
435 MigrationTwoClientTest() : MigrationTest(TWO_CLIENT) {} 428 MigrationTwoClientTest() : MigrationTest(TWO_CLIENT_LEGACY) {}
436 virtual ~MigrationTwoClientTest() {} 429 virtual ~MigrationTwoClientTest() {}
437 430
438 // Helper function that verifies that preferences sync still works. 431 // Helper function that verifies that preferences sync still works.
439 void VerifyPrefSync() { 432 void VerifyPrefSync() {
440 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); 433 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
441 ChangeBooleanPref(0, prefs::kShowHomeButton); 434 ChangeBooleanPref(0, prefs::kShowHomeButton);
442 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 435 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
443 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); 436 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
444 } 437 }
445 438
446 void RunTwoClientMigrationTest(const MigrationList& migration_list, 439 void RunTwoClientMigrationTest(const MigrationList& migration_list,
447 TriggerMethod trigger_method) { 440 TriggerMethod trigger_method) {
448 if (!ShouldRunMigrationTest()) {
449 return;
450 }
451 ASSERT_TRUE(SetupSync()); 441 ASSERT_TRUE(SetupSync());
452 442
453 // Make sure pref sync works before running the migration test. 443 // Make sure pref sync works before running the migration test.
454 VerifyPrefSync(); 444 VerifyPrefSync();
455 445
456 RunMigrationTest(migration_list, trigger_method); 446 RunMigrationTest(migration_list, trigger_method);
457 447
458 // Make sure pref sync still works after running the migration 448 // Make sure pref sync still works after running the migration
459 // test. 449 // test.
460 VerifyPrefSync(); 450 VerifyPrefSync();
461 } 451 }
462 452
463 private: 453 private:
464 DISALLOW_COPY_AND_ASSIGN(MigrationTwoClientTest); 454 DISALLOW_COPY_AND_ASSIGN(MigrationTwoClientTest);
465 }; 455 };
466 456
467 // Easiest possible test of migration errors: triggers a server 457 // Easiest possible test of migration errors: triggers a server
468 // migration on one datatype, then modifies some other datatype. 458 // migration on one datatype, then modifies some other datatype.
469 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, MigratePrefsThenModifyBookmark) { 459 // See crbug.com/392989.
460 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest,
461 DISABLED_MigratePrefsThenModifyBookmark) {
470 RunTwoClientMigrationTest(MakeList(syncer::PREFERENCES), 462 RunTwoClientMigrationTest(MakeList(syncer::PREFERENCES),
471 MODIFY_BOOKMARK); 463 MODIFY_BOOKMARK);
472 } 464 }
473 465
474 // Triggers a server migration on two datatypes, then makes a local 466 // Triggers a server migration on two datatypes, then makes a local
475 // modification to one of them. 467 // modification to one of them.
468 // See crbug.com/392989.
476 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest, 469 IN_PROC_BROWSER_TEST_F(MigrationTwoClientTest,
477 MigratePrefsAndBookmarksThenModifyBookmark) { 470 DISABLED_MigratePrefsAndBookmarksThenModifyBookmark) {
478 RunTwoClientMigrationTest( 471 RunTwoClientMigrationTest(
479 MakeList(syncer::PREFERENCES, syncer::BOOKMARKS), 472 MakeList(syncer::PREFERENCES, syncer::BOOKMARKS),
480 MODIFY_BOOKMARK); 473 MODIFY_BOOKMARK);
481 } 474 }
482 475
483 // Migrate every datatype in sequence; the catch being that the server 476 // Migrate every datatype in sequence; the catch being that the server
484 // will only tell the client about the migrations one at a time. 477 // will only tell the client about the migrations one at a time.
485 // TODO(rsimha): This test takes longer than 60 seconds, and will cause tree 478 // TODO(rsimha): This test takes longer than 60 seconds, and will cause tree
486 // redness due to sharding. 479 // redness due to sharding.
487 // Re-enable this test after syncer::kInitialBackoffShortRetrySeconds is reduced 480 // Re-enable this test after syncer::kInitialBackoffShortRetrySeconds is reduced
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // Do not add optional datatypes. 514 // Do not add optional datatypes.
522 } 515 }
523 516
524 virtual ~MigrationReconfigureTest() {} 517 virtual ~MigrationReconfigureTest() {}
525 518
526 private: 519 private:
527 DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest); 520 DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest);
528 }; 521 };
529 522
530 } // namespace 523 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/test/integration/status_change_checker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698