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

Side by Side Diff: chrome/test/live_sync/migration_errors_test.cc

Issue 7259005: Allow sync integration tests to operate on multiple datatypes: Preferences + Bookmarks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add BookmarksHelper class. (TODO: Trim lines to 80 chars) Created 9 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
OLDNEW
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/bookmarks/bookmark_model.h"
6 #include "chrome/browser/prefs/scoped_user_pref_update.h" 5 #include "chrome/browser/prefs/scoped_user_pref_update.h"
7 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/profile_sync_service_harness.h" 7 #include "chrome/browser/sync/profile_sync_service_harness.h"
9 #include "chrome/browser/translate/translate_prefs.h" 8 #include "chrome/browser/translate/translate_prefs.h"
10 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
11 #include "chrome/test/live_sync/live_preferences_sync_test.h" 10 #include "chrome/test/live_sync/live_sync_test.h"
11 #include "chrome/test/live_sync/bookmarks_helper.h"
12 #include "chrome/test/live_sync/preferences_helper.h"
12 #include "chrome/test/ui_test_utils.h" 13 #include "chrome/test/ui_test_utils.h"
13 14
14 // TODO(nick): In this file, we want to test multiple datatypes, but the test 15 class MigrationErrorsTest : public LiveSyncTest {
15 // framework only allows us access to the helper methods of whichever parent 16 public:
16 // class we pick. We should move away from inheritance, and make this a 17 MigrationErrorsTest() : LiveSyncTest(TWO_CLIENT) {}
17 // TwoClientLiveSyncTest that uses methods currently found in PreferencesSync 18 virtual ~MigrationErrorsTest() {}
18 // and BookmarksSync code. We ought to be able to check for profile equality
19 // on all datatypes.
20 class MigrationErrorsTest : public TwoClientLivePreferencesSyncTest {
21 19
20 private:
21 DISALLOW_COPY_AND_ASSIGN(MigrationErrorsTest);
22 }; 22 };
23 23
24 // Easiest possible test of migration errors: triggers a server migration on 24 // Easiest possible test of migration errors: triggers a server migration on
25 // one datatype, then modifies some other datatype. 25 // one datatype, then modifies some other datatype.
26 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigratePrefsThenModifyBookmark) { 26 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigratePrefsThenModifyBookmark) {
27 if (!ServerSupportsErrorTriggering()) { 27 if (!ServerSupportsErrorTriggering()) {
28 LOG(WARNING) << "Test skipped in this server environment."; 28 LOG(WARNING) << "Test skipped in this server environment.";
29 return; 29 return;
30 } 30 }
31 31
32 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 32 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
33 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton),
34 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
35 33
36 // Phase 1: Before migrating anything, create & sync a preference. 34 // Phase 1: Before migrating anything, create & sync a preference.
37 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( 35 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
38 prefs::kShowHomeButton); 36 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
39 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 37 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
40 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 38 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
41 ASSERT_TRUE(AwaitQuiescence());
42
43 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
44 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
45 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
46 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
47 39
48 // Phase 2: Trigger a preference migration on the server. 40 // Phase 2: Trigger a preference migration on the server.
49 syncable::ModelTypeSet migrate_types; 41 syncable::ModelTypeSet migrate_types;
50 migrate_types.insert(syncable::PREFERENCES); 42 migrate_types.insert(syncable::PREFERENCES);
51 TriggerMigrationDoneError(migrate_types); 43 TriggerMigrationDoneError(migrate_types);
52 44
53 // Phase 3: Modify a bookmark and await quiescence. 45 // Phase 3: Modify a bookmark and wait for it to sync.
54 Profile* p = GetProfile(0); 46 ASSERT_TRUE(BookmarksHelper::AddURL(0, BookmarksHelper::IndexedURLTitle(0),
55 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), 47 GURL(BookmarksHelper::IndexedURL(0))) != NULL);
56 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); 48 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
57
58 ASSERT_TRUE(AwaitQuiescence());
59 49
60 // Phase 4: Verify that preferences can still be synchronized. 50 // Phase 4: Verify that preferences can still be synchronized.
61 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 51 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
62 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); 52 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
63 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 53 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
64 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); 54 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
65
66 new_kShowHomeButton = !new_kShowHomeButton;
67 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
68 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
69 ASSERT_TRUE(AwaitQuiescence());
70
71 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
72 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
73 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
74 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
75 } 55 }
76 56
77 // Triggers a server migration on two datatypes, then makes a local 57 // Triggers a server migration on two datatypes, then makes a local
78 // modification to one of them. 58 // modification to one of them.
79 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, 59 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest,
80 MigratePrefsAndBookmarksThenModifyBookmark) { 60 MigratePrefsAndBookmarksThenModifyBookmark) {
81 if (!ServerSupportsErrorTriggering()) { 61 if (!ServerSupportsErrorTriggering()) {
82 LOG(WARNING) << "Test skipped in this server environment."; 62 LOG(WARNING) << "Test skipped in this server environment.";
83 return; 63 return;
84 } 64 }
85 65
86 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 66 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
87 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton),
88 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
89 67
90 // Phase 1: Before migrating anything, create & sync a preference. 68 // Phase 1: Before migrating anything, create & sync a preference.
91 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( 69 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
92 prefs::kShowHomeButton); 70 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
93 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 71 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
94 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 72 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
95 ASSERT_TRUE(AwaitQuiescence());
96
97 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
98 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
99 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
100 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
101 73
102 // Phase 2: Trigger a migration on the server. 74 // Phase 2: Trigger a migration on the server.
103 syncable::ModelTypeSet migrate_types; 75 syncable::ModelTypeSet migrate_types;
104 migrate_types.insert(syncable::PREFERENCES); 76 migrate_types.insert(syncable::PREFERENCES);
105 migrate_types.insert(syncable::BOOKMARKS); 77 migrate_types.insert(syncable::BOOKMARKS);
106 TriggerMigrationDoneError(migrate_types); 78 TriggerMigrationDoneError(migrate_types);
107 79
108 // Phase 3: Modify a bookmark and await quiescence. 80 // Phase 3: Modify a bookmark and wait for it to sync.
109 Profile* p = GetProfile(0); 81 ASSERT_TRUE(BookmarksHelper::AddURL(0, BookmarksHelper::IndexedURLTitle(0),
110 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), 82 GURL(BookmarksHelper::IndexedURL(0))) != NULL);
111 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); 83 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
112 ASSERT_TRUE(AwaitQuiescence());
113 84
114 // Phase 4: Verify that preferences can still be synchronized. 85 // Phase 4: Verify that preferences can still be synchronized.
115 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 86 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
116 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); 87 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
117 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 88 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
118 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); 89 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
119
120 new_kShowHomeButton = !new_kShowHomeButton;
121 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
122 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
123 ASSERT_TRUE(AwaitQuiescence());
124
125 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
126 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
127 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
128 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
129 } 90 }
130 91
131 // Migrate every datatype in sequence; the catch being that the server 92 // Migrate every datatype in sequence; the catch being that the server
132 // will only tell the client about the migrations one at a time. 93 // will only tell the client about the migrations one at a time.
133 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithoutNigori) { 94 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithoutNigori) {
134 if (!ServerSupportsErrorTriggering()) { 95 if (!ServerSupportsErrorTriggering()) {
135 LOG(WARNING) << "Test skipped in this server environment."; 96 LOG(WARNING) << "Test skipped in this server environment.";
136 return; 97 return;
137 } 98 }
138 99
139 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 100 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
140 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton),
141 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
142 101
143 // Phase 1: Before migrating anything, create & sync a preference. 102 // Phase 1: Before migrating anything, create & sync a preference.
144 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( 103 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
145 prefs::kShowHomeButton); 104 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
146 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 105 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
147 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 106 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
148 ASSERT_TRUE(AwaitQuiescence());
149
150 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
151 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
152 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
153 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
154 107
155 // Phase 2: Queue up a horrendous number of migrations on the server. 108 // Phase 2: Queue up a horrendous number of migrations on the server.
156 // Let the first nudge be a datatype that's neither prefs nor bookmarks. 109 // Let the first nudge be a datatype that's neither prefs nor bookmarks.
157 syncable::ModelTypeSet migrate_themes; 110 syncable::ModelTypeSet migrate_themes;
158 migrate_themes.insert(syncable::THEMES); 111 migrate_themes.insert(syncable::THEMES);
159 TriggerMigrationDoneError(migrate_themes); 112 TriggerMigrationDoneError(migrate_themes);
160 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; 113 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT;
161 ++i) { 114 ++i) {
162 if (i == syncable::NIGORI) { 115 if (i == syncable::NIGORI) {
163 continue; 116 continue;
164 } 117 }
165 syncable::ModelTypeSet migrate_types; 118 syncable::ModelTypeSet migrate_types;
166 migrate_types.insert(syncable::ModelTypeFromInt(i)); 119 migrate_types.insert(syncable::ModelTypeFromInt(i));
167 TriggerMigrationDoneError(migrate_types); 120 TriggerMigrationDoneError(migrate_types);
168 } 121 }
169 122
170 // Phase 3: Modify a bookmark and await quiescence. 123 // Phase 3: Modify a bookmark and wait for it to sync.
171 Profile* p = GetProfile(0); 124 ASSERT_TRUE(BookmarksHelper::AddURL(0, BookmarksHelper::IndexedURLTitle(0),
172 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), 125 GURL(BookmarksHelper::IndexedURL(0))) != NULL);
173 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); 126 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
174
175 ASSERT_TRUE(AwaitQuiescence());
176 127
177 // Phase 4: Verify that preferences can still be synchronized. 128 // Phase 4: Verify that preferences can still be synchronized.
178 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 129 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
179 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); 130 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
180 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 131 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
181 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); 132 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
182
183 new_kShowHomeButton = !new_kShowHomeButton;
184 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
185 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
186 ASSERT_TRUE(AwaitQuiescence());
187
188 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
189 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
190 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
191 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
192 } 133 }
193 134
194 // Fails because the client doesn't know how to not sync NIGORI. 135 // Fails because the client doesn't know how to not sync NIGORI.
195 // TODO(timsteele): Fix http://crbug.com/80333 and re-enable. 136 // TODO(timsteele): Fix http://crbug.com/80333 and re-enable.
196 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, 137 IN_PROC_BROWSER_TEST_F(MigrationErrorsTest, MigrationHellWithNigori) {
197 MigrationHellWithNigori) {
198 if (!ServerSupportsErrorTriggering()) { 138 if (!ServerSupportsErrorTriggering()) {
199 LOG(WARNING) << "Test skipped in this server environment."; 139 LOG(WARNING) << "Test skipped in this server environment.";
200 return; 140 return;
201 } 141 }
202 142
203 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 143 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
204 ASSERT_EQ(GetPrefs(0)->GetBoolean(prefs::kShowHomeButton),
205 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
206 144
207 // Phase 1: Before migrating anything, create & sync a preference. 145 // Phase 1: Before migrating anything, create & sync a preference.
208 bool new_kShowHomeButton = !GetVerifierPrefs()->GetBoolean( 146 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
209 prefs::kShowHomeButton); 147 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
210 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 148 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
211 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton); 149 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
212 ASSERT_TRUE(AwaitQuiescence());
213
214 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
215 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
216 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
217 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
218 150
219 // Phase 2: Queue up a horrendous number of migrations on the server. 151 // Phase 2: Queue up a horrendous number of migrations on the server.
220 // Let the first nudge be a datatype that's neither prefs nor bookmarks. 152 // Let the first nudge be a datatype that's neither prefs nor bookmarks.
221 syncable::ModelTypeSet migrate_themes; 153 syncable::ModelTypeSet migrate_themes;
222 migrate_themes.insert(syncable::THEMES); 154 migrate_themes.insert(syncable::THEMES);
223 TriggerMigrationDoneError(migrate_themes); 155 TriggerMigrationDoneError(migrate_themes);
224 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; 156 for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT;
225 ++i) { 157 ++i) {
226 // TODO(lipalani): If all types are disabled syncer freaks out. Fix it. 158 // TODO(lipalani): If all types are disabled syncer freaks out. Fix it.
227 if (i == syncable::BOOKMARKS) { 159 if (i == syncable::BOOKMARKS) {
228 continue; 160 continue;
229 } 161 }
230 syncable::ModelTypeSet migrate_types; 162 syncable::ModelTypeSet migrate_types;
231 migrate_types.insert(syncable::ModelTypeFromInt(i)); 163 migrate_types.insert(syncable::ModelTypeFromInt(i));
232 TriggerMigrationDoneError(migrate_types); 164 TriggerMigrationDoneError(migrate_types);
233 } 165 }
234 166
235 // Phase 3: modify a bookmark and wait for quiescence. 167 // Phase 3: Modify a bookmark and wait for it to sync.
236 Profile* p = GetProfile(0); 168 ASSERT_TRUE(BookmarksHelper::AddURL(0, BookmarksHelper::IndexedURLTitle(0),
237 p->GetBookmarkModel()->AddURL(p->GetBookmarkModel()->other_node(), 169 GURL(BookmarksHelper::IndexedURL(0))) != NULL);
238 0, ASCIIToUTF16("nudge"), GURL("http://nudge.net")); 170 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
239
240 ASSERT_TRUE(AwaitQuiescence());
241 171
242 // Phase 4: Verify that preferences can still be synchronized. 172 // Phase 4: Verify that preferences can still be synchronized.
243 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 173 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
244 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton)); 174 PreferencesHelper::ChangeBooleanPref(0, prefs::kShowHomeButton);
245 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton), 175 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
246 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton)); 176 ASSERT_TRUE(PreferencesHelper::BooleanPrefMatches(prefs::kShowHomeButton));
247
248 new_kShowHomeButton = !new_kShowHomeButton;
249 GetVerifierPrefs()->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
250 GetPrefs(0)->SetBoolean(prefs::kShowHomeButton, new_kShowHomeButton);
251 ASSERT_TRUE(AwaitQuiescence());
252
253 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
254 GetPrefs(0)->GetBoolean(prefs::kShowHomeButton));
255 ASSERT_EQ(GetVerifierPrefs()->GetBoolean(prefs::kShowHomeButton),
256 GetPrefs(1)->GetBoolean(prefs::kShowHomeButton));
257 } 177 }
258
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698