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

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

Powered by Google App Engine
This is Rietveld 408576698