| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 AddTestSwitches(cl); | 396 AddTestSwitches(cl); |
| 397 // Do not add optional datatypes. | 397 // Do not add optional datatypes. |
| 398 } | 398 } |
| 399 | 399 |
| 400 virtual ~MigrationReconfigureTest() {} | 400 virtual ~MigrationReconfigureTest() {} |
| 401 | 401 |
| 402 private: | 402 private: |
| 403 DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest); | 403 DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest); |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, SetSyncTabs) { | 406 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, DISABLED_SetSyncTabs) { |
| 407 if (!ServerSupportsErrorTriggering()) { | 407 if (!ServerSupportsErrorTriggering()) { |
| 408 LOG(WARNING) << "Test skipped in this server environment."; | 408 LOG(WARNING) << "Test skipped in this server environment."; |
| 409 return; | 409 return; |
| 410 } | 410 } |
| 411 | 411 |
| 412 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 412 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 413 ASSERT_FALSE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); | 413 ASSERT_FALSE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); |
| 414 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 414 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 415 | 415 |
| 416 // Phase 1: Before migrating anything, create & sync a preference. | 416 // Phase 1: Before migrating anything, create & sync a preference. |
| 417 VerifyPrefSync(); | 417 VerifyPrefSync(); |
| 418 | 418 |
| 419 // Phase 2: Trigger setting the sync_tabs field. | 419 // Phase 2: Trigger setting the sync_tabs field. |
| 420 TriggerSetSyncTabs(); | 420 TriggerSetSyncTabs(); |
| 421 | 421 |
| 422 // Phase 3: Modify a bookmark and wait for it to sync. | 422 // Phase 3: Modify a bookmark and wait for it to sync. |
| 423 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); | 423 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); |
| 424 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 424 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 425 | 425 |
| 426 // Phase 4: Verify that preferences can still be synchronized. | 426 // Phase 4: Verify that preferences can still be synchronized. |
| 427 VerifyPrefSync(); | 427 VerifyPrefSync(); |
| 428 | 428 |
| 429 // Phase 5: Verify that sessions are registered and enabled. | 429 // Phase 5: Verify that sessions are registered and enabled. |
| 430 ASSERT_TRUE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); | 430 ASSERT_TRUE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); |
| 431 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 431 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 432 } | 432 } |
| 433 | 433 |
| 434 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, SetSyncTabsAndMigrate) { | 434 IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, |
| 435 DISABLED_SetSyncTabsAndMigrate) { |
| 435 if (!ServerSupportsErrorTriggering()) { | 436 if (!ServerSupportsErrorTriggering()) { |
| 436 LOG(WARNING) << "Test skipped in this server environment."; | 437 LOG(WARNING) << "Test skipped in this server environment."; |
| 437 return; | 438 return; |
| 438 } | 439 } |
| 439 | 440 |
| 440 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 441 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 441 ASSERT_FALSE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); | 442 ASSERT_FALSE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); |
| 442 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 443 ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 443 | 444 |
| 444 // Phase 1: Before migrating anything, create & sync a preference. | 445 // Phase 1: Before migrating anything, create & sync a preference. |
| 445 VerifyPrefSync(); | 446 VerifyPrefSync(); |
| 446 | 447 |
| 447 // Phase 2: Trigger setting the sync_tabs field. | 448 // Phase 2: Trigger setting the sync_tabs field. |
| 448 TriggerSetSyncTabs(); | 449 TriggerSetSyncTabs(); |
| 449 | 450 |
| 450 // Phase 3: Trigger a preference migration on the server. | 451 // Phase 3: Trigger a preference migration on the server. |
| 451 RunMigrationTest(MakeList(syncable::PREFERENCES), MODIFY_BOOKMARK); | 452 RunMigrationTest(MakeList(syncable::PREFERENCES), MODIFY_BOOKMARK); |
| 452 | 453 |
| 453 // Phase 5: Verify that preferences can still be synchronized. | 454 // Phase 5: Verify that preferences can still be synchronized. |
| 454 VerifyPrefSync(); | 455 VerifyPrefSync(); |
| 455 | 456 |
| 456 // Phase 6: Verify that sessions are registered and enabled. | 457 // Phase 6: Verify that sessions are registered and enabled. |
| 457 ASSERT_TRUE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); | 458 ASSERT_TRUE(GetClient(0)->IsTypeRunning(syncable::SESSIONS)); |
| 458 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); | 459 ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS)); |
| 459 } | 460 } |
| 460 | 461 |
| 461 } // namespace | 462 } // namespace |
| OLD | NEW |