Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 due to http://crbug.com/92928. |
| 59 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, FAILS_PrefsNigori) { | 59 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, 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. |
| 70 { | 70 { |
| 71 syncable::ModelTypeSet migrate_types; | 71 syncable::ModelTypeSet migrate_types; |
| 72 migrate_types.insert(syncable::PREFERENCES); | 72 migrate_types.insert(syncable::PREFERENCES); |
| 73 TriggerMigrationDoneError(migrate_types); | 73 TriggerMigrationDoneError(migrate_types); |
| 74 } | 74 } |
| 75 { | 75 { |
| 76 syncable::ModelTypeSet migrate_types; | 76 syncable::ModelTypeSet migrate_types; |
| 77 migrate_types.insert(syncable::NIGORI); | 77 migrate_types.insert(syncable::NIGORI); |
| 78 TriggerMigrationDoneError(migrate_types); | 78 TriggerMigrationDoneError(migrate_types); |
| 79 } | 79 } |
| 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")); |
|
akalin
2011/08/19 01:34:28
TODO: wait for configure to be done instead of a f
| |
| 88 } | 88 } |
| 89 | 89 |
| 90 // TODO(akalin): Fails due to http://crbug.com/92928. | 90 // TODO(akalin): Fails due to http://crbug.com/92928. |
| 91 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, FAILS_BookmarksPrefs) { | 91 IN_PROC_BROWSER_TEST_F(MigrationCycleTest, 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 |
| 102 // server. | 102 // server. |
| 103 { | 103 { |
| 104 syncable::ModelTypeSet migrate_types; | 104 syncable::ModelTypeSet migrate_types; |
| 105 migrate_types.insert(syncable::BOOKMARKS); | 105 migrate_types.insert(syncable::BOOKMARKS); |
| 106 TriggerMigrationDoneError(migrate_types); | 106 TriggerMigrationDoneError(migrate_types); |
| 107 } | 107 } |
| 108 { | 108 { |
| 109 syncable::ModelTypeSet migrate_types; | 109 syncable::ModelTypeSet migrate_types; |
| 110 migrate_types.insert(syncable::PREFERENCES); | 110 migrate_types.insert(syncable::PREFERENCES); |
| 111 TriggerMigrationDoneError(migrate_types); | 111 TriggerMigrationDoneError(migrate_types); |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Phase 2: Modify a bookmark (to trigger migration) and wait for a | 114 // Phase 2: Modify a bookmark (to trigger migration) and wait for a |
| 115 // sync cycle. | 115 // sync cycle. |
| 116 // TODO(akalin): Shouldn't need to wait for full sync cycle; see | 116 // TODO(akalin): Shouldn't need to wait for full sync cycle; see |
| 117 // 93167. | 117 // 93167. |
| 118 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); | 118 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); |
| 119 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Migration")); | 119 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Migration")); |
|
akalin
2011/08/19 01:34:28
Here, too
| |
| 120 } | 120 } |
| 121 | 121 |
| 122 // TODO(akalin): Add tests where the migration trigger is a poll or a | 122 // TODO(akalin): Add tests where the migration trigger is a poll or a |
| 123 // nudge from notifications. | 123 // nudge from notifications. |
| 124 | 124 |
| 125 class MigrationErrorsTest : public LiveSyncTest { | 125 class MigrationErrorsTest : public LiveSyncTest { |
| 126 public: | 126 public: |
| 127 MigrationErrorsTest() : LiveSyncTest(TWO_CLIENT) {} | 127 MigrationErrorsTest() : LiveSyncTest(TWO_CLIENT) {} |
| 128 virtual ~MigrationErrorsTest() {} | 128 virtual ~MigrationErrorsTest() {} |
| 129 | 129 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 // Phase 3: Modify a bookmark and wait for it to sync. | 272 // Phase 3: Modify a bookmark and wait for it to sync. |
| 273 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); | 273 ASSERT_TRUE(AddURL(0, IndexedURLTitle(0), GURL(IndexedURL(0))) != NULL); |
| 274 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 274 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 275 | 275 |
| 276 // Phase 4: Verify that preferences can still be synchronized. | 276 // Phase 4: Verify that preferences can still be synchronized. |
| 277 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 277 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 278 ChangeBooleanPref(0, prefs::kShowHomeButton); | 278 ChangeBooleanPref(0, prefs::kShowHomeButton); |
| 279 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 279 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 280 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); | 280 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); |
| 281 } | 281 } |
| OLD | NEW |