OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/bookmark_app_helper.h" | 10 #include "chrome/browser/extensions/bookmark_app_helper.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 using apps_helper::EnableApp; | 33 using apps_helper::EnableApp; |
34 using apps_helper::FixNTPOrdinalCollisions; | 34 using apps_helper::FixNTPOrdinalCollisions; |
35 using apps_helper::GetAppLaunchOrdinalForApp; | 35 using apps_helper::GetAppLaunchOrdinalForApp; |
36 using apps_helper::IncognitoDisableApp; | 36 using apps_helper::IncognitoDisableApp; |
37 using apps_helper::IncognitoEnableApp; | 37 using apps_helper::IncognitoEnableApp; |
38 using apps_helper::InstallApp; | 38 using apps_helper::InstallApp; |
39 using apps_helper::InstallPlatformApp; | 39 using apps_helper::InstallPlatformApp; |
40 using apps_helper::SetAppLaunchOrdinalForApp; | 40 using apps_helper::SetAppLaunchOrdinalForApp; |
41 using apps_helper::SetPageOrdinalForApp; | 41 using apps_helper::SetPageOrdinalForApp; |
42 using apps_helper::UninstallApp; | 42 using apps_helper::UninstallApp; |
43 using apps_helper::AwaitAllProfilesHaveSameApps; | |
44 | 43 |
45 namespace { | 44 namespace { |
46 | 45 |
47 extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) { | 46 extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) { |
48 return extensions::ExtensionRegistry::Get(profile); | 47 return extensions::ExtensionRegistry::Get(profile); |
49 } | 48 } |
50 | 49 |
51 ExtensionService* GetExtensionService(Profile* profile) { | 50 ExtensionService* GetExtensionService(Profile* profile) { |
52 return extensions::ExtensionSystem::Get(profile)->extension_service(); | 51 return extensions::ExtensionSystem::Get(profile)->extension_service(); |
53 } | 52 } |
54 | 53 |
55 } // namespace | 54 } // namespace |
56 | 55 |
57 class TwoClientAppsSyncTest : public SyncTest { | 56 class TwoClientAppsSyncTest : public SyncTest { |
58 public: | 57 public: |
59 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) { | 58 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) { |
60 DisableVerifier(); | 59 DisableVerifier(); |
61 } | 60 } |
62 | 61 |
63 ~TwoClientAppsSyncTest() override {} | 62 ~TwoClientAppsSyncTest() override {} |
64 | 63 |
65 bool TestUsesSelfNotifications() override { return false; } | 64 bool TestUsesSelfNotifications() override { return false; } |
66 | 65 |
67 private: | 66 private: |
68 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); | 67 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); |
69 }; | 68 }; |
70 | 69 |
71 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(StartWithNoApps)) { | 70 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(StartWithNoApps)) { |
72 ASSERT_TRUE(SetupSync()); | 71 ASSERT_TRUE(SetupSync()); |
73 | 72 ASSERT_TRUE(AppsMatchChecker().Wait()); |
74 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | |
75 } | 73 } |
76 | 74 |
77 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(StartWithSameApps)) { | 75 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(StartWithSameApps)) { |
78 ASSERT_TRUE(SetupClients()); | 76 ASSERT_TRUE(SetupClients()); |
79 | 77 |
80 const int kNumApps = 5; | 78 const int kNumApps = 5; |
81 for (int i = 0; i < kNumApps; ++i) { | 79 for (int i = 0; i < kNumApps; ++i) { |
82 InstallApp(GetProfile(0), i); | 80 InstallApp(GetProfile(0), i); |
83 InstallApp(GetProfile(1), i); | 81 InstallApp(GetProfile(1), i); |
84 } | 82 } |
85 | 83 |
86 ASSERT_TRUE(SetupSync()); | 84 ASSERT_TRUE(SetupSync()); |
87 | 85 ASSERT_TRUE(AppsMatchChecker().Wait()); |
88 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | |
89 } | 86 } |
90 | 87 |
91 // Install some apps on both clients, some on only one client, some on only the | 88 // Install some apps on both clients, some on only one client, some on only the |
92 // other, and sync. Both clients should end up with all apps, and the app and | 89 // other, and sync. Both clients should end up with all apps, and the app and |
93 // page ordinals should be identical. | 90 // page ordinals should be identical. |
94 // Disabled, see http://crbug.com/434438 for details. | 91 // Disabled, see http://crbug.com/434438 for details. |
95 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DISABLED_StartWithDifferentApps) { | 92 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DISABLED_StartWithDifferentApps) { |
96 ASSERT_TRUE(SetupClients()); | 93 ASSERT_TRUE(SetupClients()); |
97 | 94 |
98 int i = 0; | 95 int i = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
110 | 107 |
111 const int kNumProfile1Apps = 10; | 108 const int kNumProfile1Apps = 10; |
112 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { | 109 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { |
113 InstallApp(GetProfile(1), i); | 110 InstallApp(GetProfile(1), i); |
114 } | 111 } |
115 | 112 |
116 const int kNumPlatformApps = 5; | 113 const int kNumPlatformApps = 5; |
117 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { | 114 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { |
118 InstallPlatformApp(GetProfile(1), i); | 115 InstallPlatformApp(GetProfile(1), i); |
119 } | 116 } |
| 117 |
120 ASSERT_TRUE(SetupSync()); | 118 ASSERT_TRUE(SetupSync()); |
121 | 119 ASSERT_TRUE(AppsMatchChecker().Wait()); |
122 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | |
123 } | 120 } |
124 | 121 |
125 // Install some apps on both clients, then sync. Then install some apps on only | 122 // Install some apps on both clients, then sync. Then install some apps on only |
126 // one client, some on only the other, and then sync again. Both clients should | 123 // one client, some on only the other, and then sync again. Both clients should |
127 // end up with all apps, and the app and page ordinals should be identical. | 124 // end up with all apps, and the app and page ordinals should be identical. |
128 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, | 125 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, |
129 E2E_ENABLED(InstallDifferentApps)) { | 126 E2E_ENABLED(InstallDifferentApps)) { |
130 ASSERT_TRUE(SetupClients()); | 127 ASSERT_TRUE(SetupClients()); |
131 | 128 |
132 int i = 0; | 129 int i = 0; |
133 | 130 |
134 const int kNumCommonApps = 5; | 131 const int kNumCommonApps = 5; |
135 for (int j = 0; j < kNumCommonApps; ++i, ++j) { | 132 for (int j = 0; j < kNumCommonApps; ++i, ++j) { |
136 InstallApp(GetProfile(0), i); | 133 InstallApp(GetProfile(0), i); |
137 InstallApp(GetProfile(1), i); | 134 InstallApp(GetProfile(1), i); |
138 } | 135 } |
139 | 136 |
140 ASSERT_TRUE(SetupSync()); | 137 ASSERT_TRUE(SetupSync()); |
141 | 138 |
142 const int kNumProfile0Apps = 10; | 139 const int kNumProfile0Apps = 10; |
143 for (int j = 0; j < kNumProfile0Apps; ++i, ++j) { | 140 for (int j = 0; j < kNumProfile0Apps; ++i, ++j) { |
144 InstallApp(GetProfile(0), i); | 141 InstallApp(GetProfile(0), i); |
145 } | 142 } |
146 | 143 |
147 const int kNumProfile1Apps = 10; | 144 const int kNumProfile1Apps = 10; |
148 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { | 145 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { |
149 InstallApp(GetProfile(1), i); | 146 InstallApp(GetProfile(1), i); |
150 } | 147 } |
151 | 148 |
152 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 149 ASSERT_TRUE(AppsMatchChecker().Wait()); |
153 } | 150 } |
154 | 151 |
155 // TCM ID - 3711279. | 152 // TCM ID - 3711279. |
156 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Add)) { | 153 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Add)) { |
157 ASSERT_TRUE(SetupSync()); | 154 ASSERT_TRUE(SetupSync()); |
158 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 155 ASSERT_TRUE(AppsMatchChecker().Wait()); |
159 | 156 |
160 InstallApp(GetProfile(0), 0); | 157 InstallApp(GetProfile(0), 0); |
161 | 158 |
162 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 159 ASSERT_TRUE(AppsMatchChecker().Wait()); |
163 } | 160 } |
164 | 161 |
165 // TCM ID - 3706267. | 162 // TCM ID - 3706267. |
166 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Uninstall)) { | 163 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Uninstall)) { |
167 ASSERT_TRUE(SetupSync()); | 164 ASSERT_TRUE(SetupSync()); |
168 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 165 ASSERT_TRUE(AppsMatchChecker().Wait()); |
169 | 166 |
170 InstallApp(GetProfile(0), 0); | 167 InstallApp(GetProfile(0), 0); |
171 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 168 ASSERT_TRUE(AppsMatchChecker().Wait()); |
172 | 169 |
173 UninstallApp(GetProfile(0), 0); | 170 UninstallApp(GetProfile(0), 0); |
174 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 171 ASSERT_TRUE(AppsMatchChecker().Wait()); |
175 } | 172 } |
176 | 173 |
177 // Install an app on one client, then sync. Then uninstall the app on the first | 174 // Install an app on one client, then sync. Then uninstall the app on the first |
178 // client and sync again. Now install a new app on the first client and sync. | 175 // client and sync again. Now install a new app on the first client and sync. |
179 // Both client should only have the second app, with identical app and page | 176 // Both client should only have the second app, with identical app and page |
180 // ordinals. | 177 // ordinals. |
181 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, | 178 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, |
182 E2E_ENABLED(UninstallThenInstall)) { | 179 E2E_ENABLED(UninstallThenInstall)) { |
183 ASSERT_TRUE(SetupSync()); | 180 ASSERT_TRUE(SetupSync()); |
184 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 181 ASSERT_TRUE(AppsMatchChecker().Wait()); |
185 | 182 |
186 InstallApp(GetProfile(0), 0); | 183 InstallApp(GetProfile(0), 0); |
187 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 184 ASSERT_TRUE(AppsMatchChecker().Wait()); |
188 | 185 |
189 UninstallApp(GetProfile(0), 0); | 186 UninstallApp(GetProfile(0), 0); |
190 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 187 ASSERT_TRUE(AppsMatchChecker().Wait()); |
191 | 188 |
192 InstallApp(GetProfile(0), 1); | 189 InstallApp(GetProfile(0), 1); |
193 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 190 ASSERT_TRUE(AppsMatchChecker().Wait()); |
194 } | 191 } |
195 | 192 |
196 // TCM ID - 3699295. | 193 // TCM ID - 3699295. |
197 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Merge)) { | 194 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Merge)) { |
198 ASSERT_TRUE(SetupSync()); | 195 ASSERT_TRUE(SetupSync()); |
199 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 196 ASSERT_TRUE(AppsMatchChecker().Wait()); |
200 | 197 |
201 InstallApp(GetProfile(0), 0); | 198 InstallApp(GetProfile(0), 0); |
202 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 199 ASSERT_TRUE(AppsMatchChecker().Wait()); |
203 | 200 |
204 UninstallApp(GetProfile(0), 0); | 201 UninstallApp(GetProfile(0), 0); |
205 | 202 |
206 InstallApp(GetProfile(0), 1); | 203 InstallApp(GetProfile(0), 1); |
207 InstallApp(GetProfile(0), 2); | 204 InstallApp(GetProfile(0), 2); |
208 | 205 |
209 InstallApp(GetProfile(1), 2); | 206 InstallApp(GetProfile(1), 2); |
210 InstallApp(GetProfile(1), 3); | 207 InstallApp(GetProfile(1), 3); |
211 | 208 |
212 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 209 ASSERT_TRUE(AppsMatchChecker().Wait()); |
213 } | 210 } |
214 | 211 |
215 // TCM ID - 7723126. | 212 // TCM ID - 7723126. |
216 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, | 213 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, |
217 E2E_ENABLED(UpdateEnableDisableApp)) { | 214 E2E_ENABLED(UpdateEnableDisableApp)) { |
218 ASSERT_TRUE(SetupSync()); | 215 ASSERT_TRUE(SetupSync()); |
219 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 216 ASSERT_TRUE(AppsMatchChecker().Wait()); |
220 | 217 |
221 InstallApp(GetProfile(0), 0); | 218 InstallApp(GetProfile(0), 0); |
222 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 219 ASSERT_TRUE(AppsMatchChecker().Wait()); |
223 | 220 |
224 DisableApp(GetProfile(0), 0); | 221 DisableApp(GetProfile(0), 0); |
225 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 222 ASSERT_TRUE(AppsMatchChecker().Wait()); |
226 | 223 |
227 EnableApp(GetProfile(1), 0); | 224 EnableApp(GetProfile(1), 0); |
228 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 225 ASSERT_TRUE(AppsMatchChecker().Wait()); |
229 } | 226 } |
230 | 227 |
231 // TCM ID - 7706637. | 228 // TCM ID - 7706637. |
232 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, | 229 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, |
233 E2E_ENABLED(UpdateIncognitoEnableDisable)) { | 230 E2E_ENABLED(UpdateIncognitoEnableDisable)) { |
234 ASSERT_TRUE(SetupSync()); | 231 ASSERT_TRUE(SetupSync()); |
235 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 232 ASSERT_TRUE(AppsMatchChecker().Wait()); |
236 | 233 |
237 InstallApp(GetProfile(0), 0); | 234 InstallApp(GetProfile(0), 0); |
238 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 235 ASSERT_TRUE(AppsMatchChecker().Wait()); |
239 | 236 |
240 IncognitoEnableApp(GetProfile(0), 0); | 237 IncognitoEnableApp(GetProfile(0), 0); |
241 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 238 ASSERT_TRUE(AppsMatchChecker().Wait()); |
242 | 239 |
243 IncognitoDisableApp(GetProfile(1), 0); | 240 IncognitoDisableApp(GetProfile(1), 0); |
244 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 241 ASSERT_TRUE(AppsMatchChecker().Wait()); |
245 } | 242 } |
246 | 243 |
247 // Install the same app on both clients, then sync. Change the page ordinal on | 244 // Install the same app on both clients, then sync. Change the page ordinal on |
248 // one client and sync. Both clients should have the updated page ordinal for | 245 // one client and sync. Both clients should have the updated page ordinal for |
249 // the app. | 246 // the app. |
250 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdatePageOrdinal)) { | 247 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdatePageOrdinal)) { |
251 ASSERT_TRUE(SetupSync()); | 248 ASSERT_TRUE(SetupSync()); |
252 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 249 ASSERT_TRUE(AppsMatchChecker().Wait()); |
253 | 250 |
254 syncer::StringOrdinal initial_page = | 251 syncer::StringOrdinal initial_page = |
255 syncer::StringOrdinal::CreateInitialOrdinal(); | 252 syncer::StringOrdinal::CreateInitialOrdinal(); |
256 InstallApp(GetProfile(0), 0); | 253 InstallApp(GetProfile(0), 0); |
257 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 254 ASSERT_TRUE(AppsMatchChecker().Wait()); |
258 | 255 |
259 syncer::StringOrdinal second_page = initial_page.CreateAfter(); | 256 syncer::StringOrdinal second_page = initial_page.CreateAfter(); |
260 SetPageOrdinalForApp(GetProfile(0), 0, second_page); | 257 SetPageOrdinalForApp(GetProfile(0), 0, second_page); |
261 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 258 ASSERT_TRUE(AppsMatchChecker().Wait()); |
262 } | 259 } |
263 | 260 |
264 // Install the same app on both clients, then sync. Change the app launch | 261 // Install the same app on both clients, then sync. Change the app launch |
265 // ordinal on one client and sync. Both clients should have the updated app | 262 // ordinal on one client and sync. Both clients should have the updated app |
266 // launch ordinal for the app. | 263 // launch ordinal for the app. |
267 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, | 264 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, |
268 E2E_ENABLED(UpdateAppLaunchOrdinal)) { | 265 E2E_ENABLED(UpdateAppLaunchOrdinal)) { |
269 ASSERT_TRUE(SetupSync()); | 266 ASSERT_TRUE(SetupSync()); |
270 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 267 ASSERT_TRUE(AppsMatchChecker().Wait()); |
271 | 268 |
272 InstallApp(GetProfile(0), 0); | 269 InstallApp(GetProfile(0), 0); |
273 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 270 ASSERT_TRUE(AppsMatchChecker().Wait()); |
274 | 271 |
275 syncer::StringOrdinal initial_position = | 272 syncer::StringOrdinal initial_position = |
276 GetAppLaunchOrdinalForApp(GetProfile(0), 0); | 273 GetAppLaunchOrdinalForApp(GetProfile(0), 0); |
277 | 274 |
278 syncer::StringOrdinal second_position = initial_position.CreateAfter(); | 275 syncer::StringOrdinal second_position = initial_position.CreateAfter(); |
279 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position); | 276 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position); |
280 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 277 ASSERT_TRUE(AppsMatchChecker().Wait()); |
281 } | 278 } |
282 | 279 |
283 // Adjust the CWS location within a page on the first client and sync. Adjust | 280 // Adjust the CWS location within a page on the first client and sync. Adjust |
284 // which page the CWS appears on and sync. Both clients should have the same | 281 // which page the CWS appears on and sync. Both clients should have the same |
285 // page and app launch ordinal values for the CWS. | 282 // page and app launch ordinal values for the CWS. |
286 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateCWSOrdinals)) { | 283 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateCWSOrdinals)) { |
287 ASSERT_TRUE(SetupSync()); | 284 ASSERT_TRUE(SetupSync()); |
288 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 285 ASSERT_TRUE(AppsMatchChecker().Wait()); |
289 | 286 |
290 // Change the app launch ordinal. | 287 // Change the app launch ordinal. |
291 syncer::StringOrdinal cws_app_launch_ordinal = | 288 syncer::StringOrdinal cws_app_launch_ordinal = |
292 extensions::ExtensionSystem::Get(GetProfile(0)) | 289 extensions::ExtensionSystem::Get(GetProfile(0)) |
293 ->app_sorting() | 290 ->app_sorting() |
294 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId); | 291 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId); |
295 extensions::ExtensionSystem::Get(GetProfile(0)) | 292 extensions::ExtensionSystem::Get(GetProfile(0)) |
296 ->app_sorting() | 293 ->app_sorting() |
297 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, | 294 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, |
298 cws_app_launch_ordinal.CreateAfter()); | 295 cws_app_launch_ordinal.CreateAfter()); |
299 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 296 ASSERT_TRUE(AppsMatchChecker().Wait()); |
300 | 297 |
301 // Change the page ordinal. | 298 // Change the page ordinal. |
302 syncer::StringOrdinal cws_page_ordinal = | 299 syncer::StringOrdinal cws_page_ordinal = |
303 extensions::ExtensionSystem::Get(GetProfile(1)) | 300 extensions::ExtensionSystem::Get(GetProfile(1)) |
304 ->app_sorting() | 301 ->app_sorting() |
305 ->GetPageOrdinal(extensions::kWebStoreAppId); | 302 ->GetPageOrdinal(extensions::kWebStoreAppId); |
306 extensions::ExtensionSystem::Get(GetProfile(1)) | 303 extensions::ExtensionSystem::Get(GetProfile(1)) |
307 ->app_sorting() | 304 ->app_sorting() |
308 ->SetPageOrdinal(extensions::kWebStoreAppId, | 305 ->SetPageOrdinal(extensions::kWebStoreAppId, |
309 cws_page_ordinal.CreateAfter()); | 306 cws_page_ordinal.CreateAfter()); |
310 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 307 ASSERT_TRUE(AppsMatchChecker().Wait()); |
311 } | 308 } |
312 | 309 |
313 // Adjust the launch type on the first client and sync. Both clients should | 310 // Adjust the launch type on the first client and sync. Both clients should |
314 // have the same launch type values for the CWS. | 311 // have the same launch type values for the CWS. |
315 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateLaunchType)) { | 312 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateLaunchType)) { |
316 ASSERT_TRUE(SetupSync()); | 313 ASSERT_TRUE(SetupSync()); |
317 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 314 ASSERT_TRUE(AppsMatchChecker().Wait()); |
318 | 315 |
319 // Change the launch type to window. | 316 // Change the launch type to window. |
320 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, | 317 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, |
321 extensions::LAUNCH_TYPE_WINDOW); | 318 extensions::LAUNCH_TYPE_WINDOW); |
322 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 319 ASSERT_TRUE(AppsMatchChecker().Wait()); |
323 ASSERT_EQ( | 320 ASSERT_EQ( |
324 extensions::GetLaunchTypePrefValue( | 321 extensions::GetLaunchTypePrefValue( |
325 extensions::ExtensionPrefs::Get(GetProfile(0)), | 322 extensions::ExtensionPrefs::Get(GetProfile(0)), |
326 extensions::kWebStoreAppId), | 323 extensions::kWebStoreAppId), |
327 extensions::LAUNCH_TYPE_WINDOW); | 324 extensions::LAUNCH_TYPE_WINDOW); |
328 | 325 |
329 // Change the launch type to regular tab. | 326 // Change the launch type to regular tab. |
330 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, | 327 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, |
331 extensions::LAUNCH_TYPE_REGULAR); | 328 extensions::LAUNCH_TYPE_REGULAR); |
332 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 329 ASSERT_TRUE(AppsMatchChecker().Wait()); |
333 | 330 |
334 ASSERT_EQ( | 331 ASSERT_EQ( |
335 extensions::GetLaunchTypePrefValue( | 332 extensions::GetLaunchTypePrefValue( |
336 extensions::ExtensionPrefs::Get(GetProfile(0)), | 333 extensions::ExtensionPrefs::Get(GetProfile(0)), |
337 extensions::kWebStoreAppId), | 334 extensions::kWebStoreAppId), |
338 extensions::LAUNCH_TYPE_REGULAR); | 335 extensions::LAUNCH_TYPE_REGULAR); |
339 } | 336 } |
340 | 337 |
341 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UnexpectedLaunchType) { | 338 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UnexpectedLaunchType) { |
342 ASSERT_TRUE(SetupSync()); | 339 ASSERT_TRUE(SetupSync()); |
343 ASSERT_TRUE(AllProfilesHaveSameApps()); | 340 ASSERT_TRUE(AllProfilesHaveSameApps()); |
344 | 341 |
345 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, | 342 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, |
346 extensions::LAUNCH_TYPE_REGULAR); | 343 extensions::LAUNCH_TYPE_REGULAR); |
347 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 344 ASSERT_TRUE(AppsMatchChecker().Wait()); |
348 | 345 |
349 const extensions::Extension* extension = | 346 const extensions::Extension* extension = |
350 GetExtensionRegistry(GetProfile(1))->GetExtensionById( | 347 GetExtensionRegistry(GetProfile(1))->GetExtensionById( |
351 extensions::kWebStoreAppId, | 348 extensions::kWebStoreAppId, |
352 extensions::ExtensionRegistry::EVERYTHING); | 349 extensions::ExtensionRegistry::EVERYTHING); |
353 ASSERT_TRUE(extension); | 350 ASSERT_TRUE(extension); |
354 | 351 |
355 ExtensionSyncService* extension_sync_service = | 352 ExtensionSyncService* extension_sync_service = |
356 ExtensionSyncService::Get(GetProfile(1)); | 353 ExtensionSyncService::Get(GetProfile(1)); |
357 | 354 |
(...skipping 10 matching lines...) Expand all Loading... |
368 original_data.incognito_enabled(), | 365 original_data.incognito_enabled(), |
369 original_data.remote_install(), | 366 original_data.remote_install(), |
370 original_data.all_urls_enabled(), | 367 original_data.all_urls_enabled(), |
371 original_data.installed_by_custodian(), | 368 original_data.installed_by_custodian(), |
372 original_data.app_launch_ordinal(), | 369 original_data.app_launch_ordinal(), |
373 original_data.page_ordinal(), | 370 original_data.page_ordinal(), |
374 extensions::NUM_LAUNCH_TYPES); | 371 extensions::NUM_LAUNCH_TYPES); |
375 extension_sync_service->ApplySyncData(invalid_launch_type_data); | 372 extension_sync_service->ApplySyncData(invalid_launch_type_data); |
376 | 373 |
377 // The launch type should remain the same. | 374 // The launch type should remain the same. |
378 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 375 ASSERT_TRUE(AppsMatchChecker().Wait()); |
379 } | 376 } |
380 | 377 |
381 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) { | 378 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) { |
382 ASSERT_TRUE(SetupSync()); | 379 ASSERT_TRUE(SetupSync()); |
383 ASSERT_TRUE(AllProfilesHaveSameApps()); | 380 ASSERT_TRUE(AllProfilesHaveSameApps()); |
384 | 381 |
385 size_t num_extensions = | 382 size_t num_extensions = |
386 GetExtensionRegistry(GetProfile(0))->enabled_extensions().size(); | 383 GetExtensionRegistry(GetProfile(0))->enabled_extensions().size(); |
387 | 384 |
388 WebApplicationInfo web_app_info; | 385 WebApplicationInfo web_app_info; |
(...skipping 16 matching lines...) Expand all Loading... |
405 content::WindowedNotificationObserver windowed_observer( | 402 content::WindowedNotificationObserver windowed_observer( |
406 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 403 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
407 base::Bind(&AllProfilesHaveSameApps)); | 404 base::Bind(&AllProfilesHaveSameApps)); |
408 windowed_observer.Wait(); | 405 windowed_observer.Wait(); |
409 } | 406 } |
410 } | 407 } |
411 | 408 |
412 // TODO(akalin): Add tests exercising: | 409 // TODO(akalin): Add tests exercising: |
413 // - Offline installation/uninstallation behavior | 410 // - Offline installation/uninstallation behavior |
414 // - App-specific properties | 411 // - App-specific properties |
OLD | NEW |