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

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

Issue 7599019: Allow sync integration tests to operate on multiple datatypes: Apps, Extensions, Themes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indents 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 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "chrome/browser/sync/profile_sync_service_harness.h" 6 #include "chrome/browser/sync/profile_sync_service_harness.h"
7 #include "chrome/test/live_sync/live_apps_sync_test.h" 7 #include "chrome/test/live_sync/apps_helper.h"
8 #include "chrome/test/live_sync/live_sync_test.h"
8 9
9 class TwoClientLiveAppsSyncTest : public LiveAppsSyncTest { 10 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
11 using apps_helper::DisableApp;
12 using apps_helper::EnableApp;
13 using apps_helper::HasSameAppsAsVerifier;
14 using apps_helper::IncognitoDisableApp;
15 using apps_helper::IncognitoEnableApp;
16 using apps_helper::InstallApp;
17 using apps_helper::InstallAppsPendingForSync;
18 using apps_helper::UninstallApp;
19
20 class TwoClientAppsSyncTest : public LiveSyncTest {
10 public: 21 public:
11 TwoClientLiveAppsSyncTest() 22 TwoClientAppsSyncTest() : LiveSyncTest(TWO_CLIENT) {}
12 : LiveAppsSyncTest(TWO_CLIENT) {}
13 23
14 virtual ~TwoClientLiveAppsSyncTest() {} 24 virtual ~TwoClientAppsSyncTest() {}
15 25
16 private: 26 private:
17 DISALLOW_COPY_AND_ASSIGN(TwoClientLiveAppsSyncTest); 27 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest);
18 }; 28 };
19 29
20 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, 30 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithNoApps) {
21 StartWithNoApps) {
22 ASSERT_TRUE(SetupSync()); 31 ASSERT_TRUE(SetupSync());
23 32
24 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 33 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
25 } 34 }
26 35
27 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, 36 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithSameApps) {
28 StartWithSameApps) {
29 ASSERT_TRUE(SetupClients()); 37 ASSERT_TRUE(SetupClients());
30 38
31 const int kNumApps = 5; 39 const int kNumApps = 5;
32 for (int i = 0; i < kNumApps; ++i) { 40 for (int i = 0; i < kNumApps; ++i) {
33 InstallApp(GetProfile(0), i); 41 InstallApp(GetProfile(0), i);
34 InstallApp(GetProfile(1), i); 42 InstallApp(GetProfile(1), i);
35 InstallApp(verifier(), i); 43 InstallApp(verifier(), i);
36 } 44 }
37 45
38 ASSERT_TRUE(SetupSync()); 46 ASSERT_TRUE(SetupSync());
39 47
40 ASSERT_TRUE(AwaitQuiescence()); 48 ASSERT_TRUE(AwaitQuiescence());
41 49
42 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 50 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
43 } 51 }
44 52
45 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, 53 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithDifferentApps) {
46 StartWithDifferentApps) {
47 ASSERT_TRUE(SetupClients()); 54 ASSERT_TRUE(SetupClients());
48 55
49 int i = 0; 56 int i = 0;
50 57
51 const int kNumCommonApps = 5; 58 const int kNumCommonApps = 5;
52 for (int j = 0; j < kNumCommonApps; ++i, ++j) { 59 for (int j = 0; j < kNumCommonApps; ++i, ++j) {
53 InstallApp(GetProfile(0), i); 60 InstallApp(GetProfile(0), i);
54 InstallApp(GetProfile(1), i); 61 InstallApp(GetProfile(1), i);
55 InstallApp(verifier(), i); 62 InstallApp(verifier(), i);
56 } 63 }
(...skipping 13 matching lines...) Expand all
70 ASSERT_TRUE(SetupSync()); 77 ASSERT_TRUE(SetupSync());
71 78
72 ASSERT_TRUE(AwaitQuiescence()); 79 ASSERT_TRUE(AwaitQuiescence());
73 80
74 InstallAppsPendingForSync(GetProfile(0)); 81 InstallAppsPendingForSync(GetProfile(0));
75 InstallAppsPendingForSync(GetProfile(1)); 82 InstallAppsPendingForSync(GetProfile(1));
76 83
77 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 84 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
78 } 85 }
79 86
80 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, 87 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) {
81 InstallDifferentApps) {
82 ASSERT_TRUE(SetupClients()); 88 ASSERT_TRUE(SetupClients());
83 89
84 int i = 0; 90 int i = 0;
85 91
86 const int kNumCommonApps = 5; 92 const int kNumCommonApps = 5;
87 for (int j = 0; j < kNumCommonApps; ++i, ++j) { 93 for (int j = 0; j < kNumCommonApps; ++i, ++j) {
88 InstallApp(GetProfile(0), i); 94 InstallApp(GetProfile(0), i);
89 InstallApp(GetProfile(1), i); 95 InstallApp(GetProfile(1), i);
90 InstallApp(verifier(), i); 96 InstallApp(verifier(), i);
91 } 97 }
(...skipping 16 matching lines...) Expand all
108 114
109 ASSERT_TRUE(AwaitQuiescence()); 115 ASSERT_TRUE(AwaitQuiescence());
110 116
111 InstallAppsPendingForSync(GetProfile(0)); 117 InstallAppsPendingForSync(GetProfile(0));
112 InstallAppsPendingForSync(GetProfile(1)); 118 InstallAppsPendingForSync(GetProfile(1));
113 119
114 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 120 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
115 } 121 }
116 122
117 // TCM ID - 3711279. 123 // TCM ID - 3711279.
118 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, Add) { 124 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Add) {
119 ASSERT_TRUE(SetupSync()); 125 ASSERT_TRUE(SetupSync());
120 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 126 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
121 127
122 InstallApp(GetProfile(0), 0); 128 InstallApp(GetProfile(0), 0);
123 InstallApp(verifier(), 0); 129 InstallApp(verifier(), 0);
124 ASSERT_TRUE(AwaitQuiescence()); 130 ASSERT_TRUE(AwaitQuiescence());
125 131
126 InstallAppsPendingForSync(GetProfile(0)); 132 InstallAppsPendingForSync(GetProfile(0));
127 InstallAppsPendingForSync(GetProfile(1)); 133 InstallAppsPendingForSync(GetProfile(1));
128 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 134 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
129 } 135 }
130 136
131 // TCM ID - 3706267. 137 // TCM ID - 3706267.
132 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, Uninstall) { 138 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Uninstall) {
133 ASSERT_TRUE(SetupSync()); 139 ASSERT_TRUE(SetupSync());
134 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 140 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
135 141
136 InstallApp(GetProfile(0), 0); 142 InstallApp(GetProfile(0), 0);
137 InstallApp(verifier(), 0); 143 InstallApp(verifier(), 0);
138 ASSERT_TRUE(AwaitQuiescence()); 144 ASSERT_TRUE(AwaitQuiescence());
139 145
140 InstallAppsPendingForSync(GetProfile(0)); 146 InstallAppsPendingForSync(GetProfile(0));
141 InstallAppsPendingForSync(GetProfile(1)); 147 InstallAppsPendingForSync(GetProfile(1));
142 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 148 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
143 149
144 UninstallApp(GetProfile(0), 0); 150 UninstallApp(GetProfile(0), 0);
145 UninstallApp(verifier(), 0); 151 UninstallApp(verifier(), 0);
146 ASSERT_TRUE(AwaitQuiescence()); 152 ASSERT_TRUE(AwaitQuiescence());
147 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 153 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
148 } 154 }
149 155
150 // TCM ID - 3699295. 156 // TCM ID - 3699295.
151 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, Merge) { 157 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Merge) {
152 ASSERT_TRUE(SetupSync()); 158 ASSERT_TRUE(SetupSync());
153 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 159 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
154 160
155 InstallApp(GetProfile(0), 0); 161 InstallApp(GetProfile(0), 0);
156 InstallApp(GetProfile(1), 0); 162 InstallApp(GetProfile(1), 0);
157 ASSERT_TRUE(AwaitQuiescence()); 163 ASSERT_TRUE(AwaitQuiescence());
158 164
159 UninstallApp(GetProfile(0), 0); 165 UninstallApp(GetProfile(0), 0);
160 InstallApp(GetProfile(0), 1); 166 InstallApp(GetProfile(0), 1);
161 InstallApp(verifier(), 1); 167 InstallApp(verifier(), 1);
162 168
163 InstallApp(GetProfile(0), 2); 169 InstallApp(GetProfile(0), 2);
164 InstallApp(GetProfile(1), 2); 170 InstallApp(GetProfile(1), 2);
165 InstallApp(verifier(), 2); 171 InstallApp(verifier(), 2);
166 172
167 InstallApp(GetProfile(1), 3); 173 InstallApp(GetProfile(1), 3);
168 InstallApp(verifier(), 3); 174 InstallApp(verifier(), 3);
169 175
170 ASSERT_TRUE(AwaitQuiescence()); 176 ASSERT_TRUE(AwaitQuiescence());
171 InstallAppsPendingForSync(GetProfile(0)); 177 InstallAppsPendingForSync(GetProfile(0));
172 InstallAppsPendingForSync(GetProfile(1)); 178 InstallAppsPendingForSync(GetProfile(1));
173 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 179 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
174 } 180 }
175 181
176 // TCM ID - 7723126. 182 // TCM ID - 7723126.
177 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, UpdateEnableDisableApp) { 183 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateEnableDisableApp) {
178 ASSERT_TRUE(SetupSync()); 184 ASSERT_TRUE(SetupSync());
179 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 185 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
180 186
181 InstallApp(GetProfile(0), 0); 187 InstallApp(GetProfile(0), 0);
182 InstallApp(GetProfile(1), 0); 188 InstallApp(GetProfile(1), 0);
183 InstallApp(verifier(), 0); 189 InstallApp(verifier(), 0);
184 ASSERT_TRUE(AwaitQuiescence()); 190 ASSERT_TRUE(AwaitQuiescence());
185 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 191 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
186 192
187 DisableApp(GetProfile(0), 0); 193 DisableApp(GetProfile(0), 0);
188 DisableApp(verifier(), 0); 194 DisableApp(verifier(), 0);
189 ASSERT_TRUE(HasSameAppsAsVerifier(0)); 195 ASSERT_TRUE(HasSameAppsAsVerifier(0));
190 ASSERT_FALSE(HasSameAppsAsVerifier(1)); 196 ASSERT_FALSE(HasSameAppsAsVerifier(1));
191 197
192 ASSERT_TRUE(AwaitQuiescence()); 198 ASSERT_TRUE(AwaitQuiescence());
193 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 199 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
194 200
195 EnableApp(GetProfile(1), 0); 201 EnableApp(GetProfile(1), 0);
196 EnableApp(verifier(), 0); 202 EnableApp(verifier(), 0);
197 ASSERT_TRUE(HasSameAppsAsVerifier(1)); 203 ASSERT_TRUE(HasSameAppsAsVerifier(1));
198 ASSERT_FALSE(HasSameAppsAsVerifier(0)); 204 ASSERT_FALSE(HasSameAppsAsVerifier(0));
199 205
200 ASSERT_TRUE(AwaitQuiescence()); 206 ASSERT_TRUE(AwaitQuiescence());
201 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 207 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
202 } 208 }
203 209
204 // TCM ID - 7706637. 210 // TCM ID - 7706637.
205 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, 211 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateIncognitoEnableDisable) {
206 UpdateIncognitoEnableDisable) {
207 ASSERT_TRUE(SetupSync()); 212 ASSERT_TRUE(SetupSync());
208 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 213 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
209 214
210 InstallApp(GetProfile(0), 0); 215 InstallApp(GetProfile(0), 0);
211 InstallApp(GetProfile(1), 0); 216 InstallApp(GetProfile(1), 0);
212 InstallApp(verifier(), 0); 217 InstallApp(verifier(), 0);
213 ASSERT_TRUE(AwaitQuiescence()); 218 ASSERT_TRUE(AwaitQuiescence());
214 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 219 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
215 220
216 IncognitoEnableApp(GetProfile(0), 0); 221 IncognitoEnableApp(GetProfile(0), 0);
217 IncognitoEnableApp(verifier(), 0); 222 IncognitoEnableApp(verifier(), 0);
218 ASSERT_TRUE(HasSameAppsAsVerifier(0)); 223 ASSERT_TRUE(HasSameAppsAsVerifier(0));
219 ASSERT_FALSE(HasSameAppsAsVerifier(1)); 224 ASSERT_FALSE(HasSameAppsAsVerifier(1));
220 225
221 ASSERT_TRUE(AwaitQuiescence()); 226 ASSERT_TRUE(AwaitQuiescence());
222 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 227 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
223 228
224 IncognitoDisableApp(GetProfile(1), 0); 229 IncognitoDisableApp(GetProfile(1), 0);
225 IncognitoDisableApp(verifier(), 0); 230 IncognitoDisableApp(verifier(), 0);
226 ASSERT_TRUE(HasSameAppsAsVerifier(1)); 231 ASSERT_TRUE(HasSameAppsAsVerifier(1));
227 ASSERT_FALSE(HasSameAppsAsVerifier(0)); 232 ASSERT_FALSE(HasSameAppsAsVerifier(0));
228 233
229 ASSERT_TRUE(AwaitQuiescence()); 234 ASSERT_TRUE(AwaitQuiescence());
230 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 235 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
231 } 236 }
232 237
233 // TCM ID - 3718276. 238 // TCM ID - 3718276.
234 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, DisableApps) { 239 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DisableApps) {
235 ASSERT_TRUE(SetupSync()); 240 ASSERT_TRUE(SetupSync());
236 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 241 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
237 242
238 ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncable::APPS)); 243 ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncable::APPS));
239 InstallApp(GetProfile(0), 0); 244 InstallApp(GetProfile(0), 0);
240 InstallApp(verifier(), 0); 245 InstallApp(verifier(), 0);
241 ASSERT_TRUE(AwaitQuiescence()); 246 ASSERT_TRUE(AwaitQuiescence());
242 ASSERT_TRUE(HasSameAppsAsVerifier(0)); 247 ASSERT_TRUE(HasSameAppsAsVerifier(0));
243 ASSERT_FALSE(HasSameAppsAsVerifier(1)); 248 ASSERT_FALSE(HasSameAppsAsVerifier(1));
244 249
245 ASSERT_TRUE(GetClient(1)->EnableSyncForDatatype(syncable::APPS)); 250 ASSERT_TRUE(GetClient(1)->EnableSyncForDatatype(syncable::APPS));
246 ASSERT_TRUE(AwaitQuiescence()); 251 ASSERT_TRUE(AwaitQuiescence());
247 252
248 InstallAppsPendingForSync(GetProfile(0)); 253 InstallAppsPendingForSync(GetProfile(0));
249 InstallAppsPendingForSync(GetProfile(1)); 254 InstallAppsPendingForSync(GetProfile(1));
250 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 255 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
251 } 256 }
252 257
253 // TCM ID - 3720303. 258 // TCM ID - 3720303.
254 IN_PROC_BROWSER_TEST_F(TwoClientLiveAppsSyncTest, DisableSync) { 259 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DisableSync) {
255 ASSERT_TRUE(SetupSync()); 260 ASSERT_TRUE(SetupSync());
256 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 261 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
257 262
258 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); 263 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
259 InstallApp(GetProfile(0), 0); 264 InstallApp(GetProfile(0), 0);
260 InstallApp(verifier(), 0); 265 InstallApp(verifier(), 0);
261 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Installed an app.")); 266 ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Installed an app."));
262 ASSERT_TRUE(HasSameAppsAsVerifier(0)); 267 ASSERT_TRUE(HasSameAppsAsVerifier(0));
263 ASSERT_FALSE(HasSameAppsAsVerifier(1)); 268 ASSERT_FALSE(HasSameAppsAsVerifier(1));
264 269
265 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); 270 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
266 ASSERT_TRUE(AwaitQuiescence()); 271 ASSERT_TRUE(AwaitQuiescence());
267 272
268 InstallAppsPendingForSync(GetProfile(0)); 273 InstallAppsPendingForSync(GetProfile(0));
269 InstallAppsPendingForSync(GetProfile(1)); 274 InstallAppsPendingForSync(GetProfile(1));
270 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 275 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
271 } 276 }
272 277
273 // TODO(akalin): Add tests exercising: 278 // TODO(akalin): Add tests exercising:
274 // - Offline installation/uninstallation behavior 279 // - Offline installation/uninstallation behavior
275 // - App-specific properties 280 // - App-specific properties
OLDNEW
« no previous file with comments | « chrome/test/live_sync/themes_helper.cc ('k') | chrome/test/live_sync/two_client_extensions_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698