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

Unified Diff: chrome/test/live_sync/migration_errors_test.cc

Issue 7669073: [Sync] Add support for enabling session sync remotely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DOUBLE R..ebase Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/live_sync/live_sync_test.cc ('k') | net/tools/testserver/chromiumsync.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/live_sync/migration_errors_test.cc
diff --git a/chrome/test/live_sync/migration_errors_test.cc b/chrome/test/live_sync/migration_errors_test.cc
index 6626ea2abc4d01a2c91cf2b38ce09ee1105ee456..fb124a430a0de22c5fc844a162d96043bdfa83fc 100644
--- a/chrome/test/live_sync/migration_errors_test.cc
+++ b/chrome/test/live_sync/migration_errors_test.cc
@@ -279,3 +279,91 @@ IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithNigori) {
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
}
+
+class MigrationReconfigureTest : public LiveSyncTest {
+ public:
+ MigrationReconfigureTest() : LiveSyncTest(TWO_CLIENT) {}
+
+ virtual void SetUpCommandLine(CommandLine* cl) OVERRIDE {
+ AddTestSwitches(cl);
+ // Do not add optional datatypes.
+ }
+
+ virtual ~MigrationReconfigureTest() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MigrationReconfigureTest);
+};
+
+IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, SetSyncTabs) {
+ if (!ServerSupportsErrorTriggering()) {
+ LOG(WARNING) << "Test skipped in this server environment.";
+ return;
+ }
+
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+ ASSERT_FALSE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS));
+ ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS));
+
+ // Phase 1: Before migrating anything, create & sync a preference.
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+ ChangeBooleanPref(0, prefs::kShowHomeButton);
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+
+ // Phase 2: Trigger setting the sync_tabs field.
+ TriggerSetSyncTabs();
+
+ // Phase 3: Modify a bookmark and wait for it to sync.
+ ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL);
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+
+ // Phase 4: Verify that preferences can still be synchronized.
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+ ChangeBooleanPref(0, prefs::kShowHomeButton);
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+
+ // Phase 5: Verify that sessions are registered and enabled.
+ ASSERT_TRUE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS));
+ ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS));
+}
+
+IN_PROC_BROWSER_TEST_F(MigrationReconfigureTest, SetSyncTabsAndMigrate) {
+ if (!ServerSupportsErrorTriggering()) {
+ LOG(WARNING) << "Test skipped in this server environment.";
+ return;
+ }
+
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+ ASSERT_FALSE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS));
+ ASSERT_FALSE(GetClient(0)->IsTypePreferred(syncable::SESSIONS));
+
+ // Phase 1: Before migrating anything, create & sync a preference.
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+ ChangeBooleanPref(0, prefs::kShowHomeButton);
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+
+ // Phase 2: Trigger setting the sync_tabs field.
+ TriggerSetSyncTabs();
+
+ // Phase 3: Trigger a preference migration on the server.
+ syncable::ModelTypeSet migrate_types;
+ migrate_types.insert(syncable::PREFERENCES);
+ TriggerMigrationDoneError(migrate_types);
+
+ // Phase 4: Modify a bookmark and wait for it to sync.
+ ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL);
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+
+ // Phase 5: Verify that preferences can still be synchronized.
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+ ChangeBooleanPref(0, prefs::kShowHomeButton);
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
+
+ // Phase 6: Verify that sessions are registered and enabled.
+ ASSERT_TRUE(GetClient(0)->IsTypeRegistered(syncable::SESSIONS));
+ ASSERT_TRUE(GetClient(0)->IsTypePreferred(syncable::SESSIONS));
+}
« no previous file with comments | « chrome/test/live_sync/live_sync_test.cc ('k') | net/tools/testserver/chromiumsync.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698