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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_apps_sync_test.cc

Issue 1850253002: Revert of [Sync] Eliminate verifier profile from sync_integration_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_sync_data.h" 12 #include "chrome/browser/extensions/extension_sync_data.h"
13 #include "chrome/browser/extensions/extension_sync_service.h" 13 #include "chrome/browser/extensions/extension_sync_service.h"
14 #include "chrome/browser/extensions/launch_util.h" 14 #include "chrome/browser/extensions/launch_util.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/sync/test/integration/apps_helper.h" 16 #include "chrome/browser/sync/test/integration/apps_helper.h"
17 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 17 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
18 #include "chrome/browser/sync/test/integration/sync_app_helper.h" 18 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
19 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 19 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
20 #include "chrome/browser/sync/test/integration/sync_test.h" 20 #include "chrome/browser/sync/test/integration/sync_test.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/test/test_utils.h" 22 #include "content/public/test/test_utils.h"
23 #include "extensions/browser/app_sorting.h" 23 #include "extensions/browser/app_sorting.h"
24 #include "extensions/browser/extension_prefs.h" 24 #include "extensions/browser/extension_prefs.h"
25 #include "extensions/browser/extension_registry.h" 25 #include "extensions/browser/extension_registry.h"
26 #include "extensions/browser/extension_system.h" 26 #include "extensions/browser/extension_system.h"
27 #include "extensions/common/constants.h" 27 #include "extensions/common/constants.h"
28 #include "sync/api/string_ordinal.h" 28 #include "sync/api/string_ordinal.h"
29 29
30 using apps_helper::AllProfilesHaveSameApps; 30 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
31 using apps_helper::CopyNTPOrdinals; 31 using apps_helper::CopyNTPOrdinals;
32 using apps_helper::DisableApp; 32 using apps_helper::DisableApp;
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::HasSameAppsAsVerifier;
36 using apps_helper::IncognitoDisableApp; 37 using apps_helper::IncognitoDisableApp;
37 using apps_helper::IncognitoEnableApp; 38 using apps_helper::IncognitoEnableApp;
38 using apps_helper::InstallApp; 39 using apps_helper::InstallApp;
39 using apps_helper::InstallPlatformApp; 40 using apps_helper::InstallPlatformApp;
40 using apps_helper::SetAppLaunchOrdinalForApp; 41 using apps_helper::SetAppLaunchOrdinalForApp;
41 using apps_helper::SetPageOrdinalForApp; 42 using apps_helper::SetPageOrdinalForApp;
42 using apps_helper::UninstallApp; 43 using apps_helper::UninstallApp;
43 using apps_helper::AwaitAllProfilesHaveSameApps; 44 using apps_helper::AwaitAllProfilesHaveSameApps;
44 45
45 namespace { 46 namespace {
46 47
47 extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) { 48 extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) {
48 return extensions::ExtensionRegistry::Get(profile); 49 return extensions::ExtensionRegistry::Get(profile);
49 } 50 }
50 51
51 ExtensionService* GetExtensionService(Profile* profile) { 52 ExtensionService* GetExtensionService(Profile* profile) {
52 return extensions::ExtensionSystem::Get(profile)->extension_service(); 53 return extensions::ExtensionSystem::Get(profile)->extension_service();
53 } 54 }
54 55
55 } // namespace 56 } // namespace
56 57
57 class TwoClientAppsSyncTest : public SyncTest { 58 class TwoClientAppsSyncTest : public SyncTest {
58 public: 59 public:
59 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) { 60 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {}
60 DisableVerifier();
61 }
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
74 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 73 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
75 } 74 }
76 75
77 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(StartWithSameApps)) { 76 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(StartWithSameApps)) {
77 DisableVerifier();
78 ASSERT_TRUE(SetupClients()); 78 ASSERT_TRUE(SetupClients());
79 79
80 const int kNumApps = 5; 80 const int kNumApps = 5;
81 for (int i = 0; i < kNumApps; ++i) { 81 for (int i = 0; i < kNumApps; ++i) {
82 InstallApp(GetProfile(0), i); 82 InstallApp(GetProfile(0), i);
83 InstallApp(GetProfile(1), i); 83 InstallApp(GetProfile(1), i);
84 } 84 }
85 85
86 ASSERT_TRUE(SetupSync()); 86 ASSERT_TRUE(SetupSync());
87 87
88 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 88 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
89 } 89 }
90 90
91 // Install some apps on both clients, some on only one client, some on only the 91 // 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 92 // other, and sync. Both clients should end up with all apps, and the app and
93 // page ordinals should be identical. 93 // page ordinals should be identical.
94 // Disabled, see http://crbug.com/434438 for details. 94 // Disabled, see http://crbug.com/434438 for details.
95 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DISABLED_StartWithDifferentApps) { 95 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DISABLED_StartWithDifferentApps) {
96 ASSERT_TRUE(SetupClients()); 96 ASSERT_TRUE(SetupClients());
97 97
98 int i = 0; 98 int i = 0;
99 99
100 const int kNumCommonApps = 5; 100 const int kNumCommonApps = 5;
101 for (int j = 0; j < kNumCommonApps; ++i, ++j) { 101 for (int j = 0; j < kNumCommonApps; ++i, ++j) {
102 InstallApp(GetProfile(0), i); 102 InstallApp(GetProfile(0), i);
103 InstallApp(GetProfile(1), i); 103 InstallApp(GetProfile(1), i);
104 InstallApp(verifier(), i);
104 } 105 }
105 106
106 const int kNumProfile0Apps = 10; 107 const int kNumProfile0Apps = 10;
107 for (int j = 0; j < kNumProfile0Apps; ++i, ++j) { 108 for (int j = 0; j < kNumProfile0Apps; ++i, ++j) {
108 InstallApp(GetProfile(0), i); 109 InstallApp(GetProfile(0), i);
110 InstallApp(verifier(), i);
111 CopyNTPOrdinals(GetProfile(0), verifier(), i);
109 } 112 }
110 113
111 const int kNumProfile1Apps = 10; 114 const int kNumProfile1Apps = 10;
112 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { 115 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) {
113 InstallApp(GetProfile(1), i); 116 InstallApp(GetProfile(1), i);
117 InstallApp(verifier(), i);
118 CopyNTPOrdinals(GetProfile(1), verifier(), i);
114 } 119 }
115 120
116 const int kNumPlatformApps = 5; 121 const int kNumPlatformApps = 5;
117 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { 122 for (int j = 0; j < kNumPlatformApps; ++i, ++j) {
118 InstallPlatformApp(GetProfile(1), i); 123 InstallPlatformApp(GetProfile(1), i);
124 InstallPlatformApp(verifier(), i);
125 CopyNTPOrdinals(GetProfile(1), verifier(), i);
119 } 126 }
127
128 FixNTPOrdinalCollisions(verifier());
129
120 ASSERT_TRUE(SetupSync()); 130 ASSERT_TRUE(SetupSync());
121 131
122 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 132 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
123 } 133 }
124 134
125 // Install some apps on both clients, then sync. Then install some apps on only 135 // 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 136 // 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. 137 // end up with all apps, and the app and page ordinals should be identical.
128 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, 138 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest,
129 E2E_ENABLED(InstallDifferentApps)) { 139 E2E_ENABLED(InstallDifferentApps)) {
140 DisableVerifier();
130 ASSERT_TRUE(SetupClients()); 141 ASSERT_TRUE(SetupClients());
131 142
132 int i = 0; 143 int i = 0;
133 144
134 const int kNumCommonApps = 5; 145 const int kNumCommonApps = 5;
135 for (int j = 0; j < kNumCommonApps; ++i, ++j) { 146 for (int j = 0; j < kNumCommonApps; ++i, ++j) {
136 InstallApp(GetProfile(0), i); 147 InstallApp(GetProfile(0), i);
137 InstallApp(GetProfile(1), i); 148 InstallApp(GetProfile(1), i);
138 } 149 }
139 150
140 ASSERT_TRUE(SetupSync()); 151 ASSERT_TRUE(SetupSync());
141 152
142 const int kNumProfile0Apps = 10; 153 const int kNumProfile0Apps = 10;
143 for (int j = 0; j < kNumProfile0Apps; ++i, ++j) { 154 for (int j = 0; j < kNumProfile0Apps; ++i, ++j) {
144 InstallApp(GetProfile(0), i); 155 InstallApp(GetProfile(0), i);
145 } 156 }
146 157
147 const int kNumProfile1Apps = 10; 158 const int kNumProfile1Apps = 10;
148 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { 159 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) {
149 InstallApp(GetProfile(1), i); 160 InstallApp(GetProfile(1), i);
150 } 161 }
151 162
152 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 163 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
153 } 164 }
154 165
155 // TCM ID - 3711279. 166 // TCM ID - 3711279.
156 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Add)) { 167 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Add)) {
168 DisableVerifier();
157 ASSERT_TRUE(SetupSync()); 169 ASSERT_TRUE(SetupSync());
158 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 170 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
159 171
160 InstallApp(GetProfile(0), 0); 172 InstallApp(GetProfile(0), 0);
161 173
162 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 174 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
163 } 175 }
164 176
165 // TCM ID - 3706267. 177 // TCM ID - 3706267.
166 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Uninstall)) { 178 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Uninstall)) {
179 DisableVerifier();
167 ASSERT_TRUE(SetupSync()); 180 ASSERT_TRUE(SetupSync());
168 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 181 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
169 182
170 InstallApp(GetProfile(0), 0); 183 InstallApp(GetProfile(0), 0);
171 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 184 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
172 185
173 UninstallApp(GetProfile(0), 0); 186 UninstallApp(GetProfile(0), 0);
174 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 187 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
175 } 188 }
176 189
177 // Install an app on one client, then sync. Then uninstall the app on the first 190 // 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. 191 // 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 192 // Both client should only have the second app, with identical app and page
180 // ordinals. 193 // ordinals.
181 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, 194 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest,
182 E2E_ENABLED(UninstallThenInstall)) { 195 E2E_ENABLED(UninstallThenInstall)) {
196 DisableVerifier();
183 ASSERT_TRUE(SetupSync()); 197 ASSERT_TRUE(SetupSync());
184 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 198 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
185 199
186 InstallApp(GetProfile(0), 0); 200 InstallApp(GetProfile(0), 0);
187 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 201 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
188 202
189 UninstallApp(GetProfile(0), 0); 203 UninstallApp(GetProfile(0), 0);
190 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 204 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
191 205
192 InstallApp(GetProfile(0), 1); 206 InstallApp(GetProfile(0), 1);
193 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 207 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
194 } 208 }
195 209
196 // TCM ID - 3699295. 210 // TCM ID - 3699295.
197 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Merge)) { 211 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(Merge)) {
212 DisableVerifier();
198 ASSERT_TRUE(SetupSync()); 213 ASSERT_TRUE(SetupSync());
199 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 214 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
200 215
201 InstallApp(GetProfile(0), 0); 216 InstallApp(GetProfile(0), 0);
202 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 217 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
203 218
204 UninstallApp(GetProfile(0), 0); 219 UninstallApp(GetProfile(0), 0);
205 220
206 InstallApp(GetProfile(0), 1); 221 InstallApp(GetProfile(0), 1);
207 InstallApp(GetProfile(0), 2); 222 InstallApp(GetProfile(0), 2);
208 223
209 InstallApp(GetProfile(1), 2); 224 InstallApp(GetProfile(1), 2);
210 InstallApp(GetProfile(1), 3); 225 InstallApp(GetProfile(1), 3);
211 226
212 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 227 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
213 } 228 }
214 229
215 // TCM ID - 7723126. 230 // TCM ID - 7723126.
216 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, 231 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest,
217 E2E_ENABLED(UpdateEnableDisableApp)) { 232 E2E_ENABLED(UpdateEnableDisableApp)) {
233 DisableVerifier();
218 ASSERT_TRUE(SetupSync()); 234 ASSERT_TRUE(SetupSync());
219 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 235 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
220 236
221 InstallApp(GetProfile(0), 0); 237 InstallApp(GetProfile(0), 0);
222 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 238 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
223 239
224 DisableApp(GetProfile(0), 0); 240 DisableApp(GetProfile(0), 0);
225 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 241 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
226 242
227 EnableApp(GetProfile(1), 0); 243 EnableApp(GetProfile(1), 0);
228 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 244 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
229 } 245 }
230 246
231 // TCM ID - 7706637. 247 // TCM ID - 7706637.
232 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, 248 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest,
233 E2E_ENABLED(UpdateIncognitoEnableDisable)) { 249 E2E_ENABLED(UpdateIncognitoEnableDisable)) {
250 DisableVerifier();
234 ASSERT_TRUE(SetupSync()); 251 ASSERT_TRUE(SetupSync());
235 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 252 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
236 253
237 InstallApp(GetProfile(0), 0); 254 InstallApp(GetProfile(0), 0);
238 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 255 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
239 256
240 IncognitoEnableApp(GetProfile(0), 0); 257 IncognitoEnableApp(GetProfile(0), 0);
241 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 258 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
242 259
243 IncognitoDisableApp(GetProfile(1), 0); 260 IncognitoDisableApp(GetProfile(1), 0);
244 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 261 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
245 } 262 }
246 263
247 // Install the same app on both clients, then sync. Change the page ordinal on 264 // 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 265 // one client and sync. Both clients should have the updated page ordinal for
249 // the app. 266 // the app.
250 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdatePageOrdinal)) { 267 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdatePageOrdinal)) {
268 DisableVerifier();
251 ASSERT_TRUE(SetupSync()); 269 ASSERT_TRUE(SetupSync());
252 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 270 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
253 271
254 syncer::StringOrdinal initial_page = 272 syncer::StringOrdinal initial_page =
255 syncer::StringOrdinal::CreateInitialOrdinal(); 273 syncer::StringOrdinal::CreateInitialOrdinal();
256 InstallApp(GetProfile(0), 0); 274 InstallApp(GetProfile(0), 0);
257 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 275 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
258 276
259 syncer::StringOrdinal second_page = initial_page.CreateAfter(); 277 syncer::StringOrdinal second_page = initial_page.CreateAfter();
260 SetPageOrdinalForApp(GetProfile(0), 0, second_page); 278 SetPageOrdinalForApp(GetProfile(0), 0, second_page);
261 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 279 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
262 } 280 }
263 281
264 // Install the same app on both clients, then sync. Change the app launch 282 // 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 283 // ordinal on one client and sync. Both clients should have the updated app
266 // launch ordinal for the app. 284 // launch ordinal for the app.
267 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, 285 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest,
268 E2E_ENABLED(UpdateAppLaunchOrdinal)) { 286 E2E_ENABLED(UpdateAppLaunchOrdinal)) {
287 DisableVerifier();
269 ASSERT_TRUE(SetupSync()); 288 ASSERT_TRUE(SetupSync());
270 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 289 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
271 290
272 InstallApp(GetProfile(0), 0); 291 InstallApp(GetProfile(0), 0);
273 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 292 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
274 293
275 syncer::StringOrdinal initial_position = 294 syncer::StringOrdinal initial_position =
276 GetAppLaunchOrdinalForApp(GetProfile(0), 0); 295 GetAppLaunchOrdinalForApp(GetProfile(0), 0);
277 296
278 syncer::StringOrdinal second_position = initial_position.CreateAfter(); 297 syncer::StringOrdinal second_position = initial_position.CreateAfter();
279 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position); 298 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position);
280 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 299 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
281 } 300 }
282 301
283 // Adjust the CWS location within a page on the first client and sync. Adjust 302 // 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 303 // which page the CWS appears on and sync. Both clients should have the same
285 // page and app launch ordinal values for the CWS. 304 // page and app launch ordinal values for the CWS.
286 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateCWSOrdinals)) { 305 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateCWSOrdinals)) {
306 DisableVerifier();
287 ASSERT_TRUE(SetupSync()); 307 ASSERT_TRUE(SetupSync());
288 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 308 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
289 309
290 // Change the app launch ordinal. 310 // Change the app launch ordinal.
291 syncer::StringOrdinal cws_app_launch_ordinal = 311 syncer::StringOrdinal cws_app_launch_ordinal =
292 extensions::ExtensionSystem::Get(GetProfile(0)) 312 extensions::ExtensionSystem::Get(GetProfile(0))
293 ->app_sorting() 313 ->app_sorting()
294 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId); 314 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId);
295 extensions::ExtensionSystem::Get(GetProfile(0)) 315 extensions::ExtensionSystem::Get(GetProfile(0))
296 ->app_sorting() 316 ->app_sorting()
297 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, 317 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId,
298 cws_app_launch_ordinal.CreateAfter()); 318 cws_app_launch_ordinal.CreateAfter());
299 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 319 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
300 320
301 // Change the page ordinal. 321 // Change the page ordinal.
302 syncer::StringOrdinal cws_page_ordinal = 322 syncer::StringOrdinal cws_page_ordinal =
303 extensions::ExtensionSystem::Get(GetProfile(1)) 323 extensions::ExtensionSystem::Get(GetProfile(1))
304 ->app_sorting() 324 ->app_sorting()
305 ->GetPageOrdinal(extensions::kWebStoreAppId); 325 ->GetPageOrdinal(extensions::kWebStoreAppId);
306 extensions::ExtensionSystem::Get(GetProfile(1)) 326 extensions::ExtensionSystem::Get(GetProfile(1))
307 ->app_sorting() 327 ->app_sorting()
308 ->SetPageOrdinal(extensions::kWebStoreAppId, 328 ->SetPageOrdinal(extensions::kWebStoreAppId,
309 cws_page_ordinal.CreateAfter()); 329 cws_page_ordinal.CreateAfter());
310 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 330 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
311 } 331 }
312 332
313 // Adjust the launch type on the first client and sync. Both clients should 333 // Adjust the launch type on the first client and sync. Both clients should
314 // have the same launch type values for the CWS. 334 // have the same launch type values for the CWS.
315 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateLaunchType)) { 335 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, E2E_ENABLED(UpdateLaunchType)) {
336 DisableVerifier();
316 ASSERT_TRUE(SetupSync()); 337 ASSERT_TRUE(SetupSync());
317 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 338 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
318 339
319 // Change the launch type to window. 340 // Change the launch type to window.
320 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, 341 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId,
321 extensions::LAUNCH_TYPE_WINDOW); 342 extensions::LAUNCH_TYPE_WINDOW);
322 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 343 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
323 ASSERT_EQ( 344 ASSERT_EQ(
324 extensions::GetLaunchTypePrefValue( 345 extensions::GetLaunchTypePrefValue(
325 extensions::ExtensionPrefs::Get(GetProfile(0)), 346 extensions::ExtensionPrefs::Get(GetProfile(0)),
326 extensions::kWebStoreAppId), 347 extensions::kWebStoreAppId),
327 extensions::LAUNCH_TYPE_WINDOW); 348 extensions::LAUNCH_TYPE_WINDOW);
328 349
329 // Change the launch type to regular tab. 350 // Change the launch type to regular tab.
330 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, 351 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId,
331 extensions::LAUNCH_TYPE_REGULAR); 352 extensions::LAUNCH_TYPE_REGULAR);
332 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 353 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
333 354
334 ASSERT_EQ( 355 ASSERT_EQ(
335 extensions::GetLaunchTypePrefValue( 356 extensions::GetLaunchTypePrefValue(
336 extensions::ExtensionPrefs::Get(GetProfile(0)), 357 extensions::ExtensionPrefs::Get(GetProfile(0)),
337 extensions::kWebStoreAppId), 358 extensions::kWebStoreAppId),
338 extensions::LAUNCH_TYPE_REGULAR); 359 extensions::LAUNCH_TYPE_REGULAR);
339 } 360 }
340 361
341 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UnexpectedLaunchType) { 362 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UnexpectedLaunchType) {
342 ASSERT_TRUE(SetupSync()); 363 ASSERT_TRUE(SetupSync());
343 ASSERT_TRUE(AllProfilesHaveSameApps()); 364 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
344 365
345 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId, 366 extensions::SetLaunchType(GetProfile(1), extensions::kWebStoreAppId,
346 extensions::LAUNCH_TYPE_REGULAR); 367 extensions::LAUNCH_TYPE_REGULAR);
368 extensions::SetLaunchType(verifier(), extensions::kWebStoreAppId,
369 extensions::LAUNCH_TYPE_REGULAR);
347 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 370 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
348 371
349 const extensions::Extension* extension = 372 const extensions::Extension* extension =
350 GetExtensionRegistry(GetProfile(1))->GetExtensionById( 373 GetExtensionRegistry(GetProfile(1))->GetExtensionById(
351 extensions::kWebStoreAppId, 374 extensions::kWebStoreAppId,
352 extensions::ExtensionRegistry::EVERYTHING); 375 extensions::ExtensionRegistry::EVERYTHING);
353 ASSERT_TRUE(extension); 376 ASSERT_TRUE(extension);
354 377
355 ExtensionSyncService* extension_sync_service = 378 ExtensionSyncService* extension_sync_service =
356 ExtensionSyncService::Get(GetProfile(1)); 379 ExtensionSyncService::Get(GetProfile(1));
(...skipping 15 matching lines...) Expand all
372 original_data.page_ordinal(), 395 original_data.page_ordinal(),
373 extensions::NUM_LAUNCH_TYPES); 396 extensions::NUM_LAUNCH_TYPES);
374 extension_sync_service->ApplySyncData(invalid_launch_type_data); 397 extension_sync_service->ApplySyncData(invalid_launch_type_data);
375 398
376 // The launch type should remain the same. 399 // The launch type should remain the same.
377 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 400 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
378 } 401 }
379 402
380 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) { 403 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) {
381 ASSERT_TRUE(SetupSync()); 404 ASSERT_TRUE(SetupSync());
382 ASSERT_TRUE(AllProfilesHaveSameApps()); 405 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
383 406
384 size_t num_extensions = 407 size_t num_extensions =
385 GetExtensionRegistry(GetProfile(0))->enabled_extensions().size(); 408 GetExtensionRegistry(GetProfile(0))->enabled_extensions().size();
386 409
387 WebApplicationInfo web_app_info; 410 WebApplicationInfo web_app_info;
388 web_app_info.app_url = GURL("http://www.chromium.org"); 411 web_app_info.app_url = GURL("http://www.chromium.org");
389 web_app_info.title = base::UTF8ToUTF16("Test name"); 412 web_app_info.title = base::UTF8ToUTF16("Test name");
390 web_app_info.description = base::UTF8ToUTF16("Test description"); 413 web_app_info.description = base::UTF8ToUTF16("Test description");
391 ++num_extensions; 414 ++num_extensions;
392 { 415 {
393 content::WindowedNotificationObserver windowed_observer( 416 content::WindowedNotificationObserver windowed_observer(
394 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 417 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
395 content::NotificationService::AllSources()); 418 content::NotificationService::AllSources());
396 extensions::CreateOrUpdateBookmarkApp(GetExtensionService(GetProfile(0)), 419 extensions::CreateOrUpdateBookmarkApp(GetExtensionService(GetProfile(0)),
397 &web_app_info); 420 &web_app_info);
398 windowed_observer.Wait(); 421 windowed_observer.Wait();
399 EXPECT_EQ(num_extensions, 422 EXPECT_EQ(num_extensions,
400 GetExtensionRegistry(GetProfile(0))->enabled_extensions().size()); 423 GetExtensionRegistry(GetProfile(0))->enabled_extensions().size());
401 } 424 }
402 { 425 {
426 content::WindowedNotificationObserver windowed_observer(
427 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
428 content::NotificationService::AllSources());
429 extensions::CreateOrUpdateBookmarkApp(GetExtensionService(verifier()),
430 &web_app_info);
431 windowed_observer.Wait();
432 EXPECT_EQ(num_extensions,
433 GetExtensionRegistry(verifier())->enabled_extensions().size());
434 }
435 {
403 // Wait for the synced app to install. 436 // Wait for the synced app to install.
404 content::WindowedNotificationObserver windowed_observer( 437 content::WindowedNotificationObserver windowed_observer(
405 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 438 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
406 base::Bind(&AllProfilesHaveSameApps)); 439 base::Bind(&AllProfilesHaveSameAppsAsVerifier));
407 windowed_observer.Wait(); 440 windowed_observer.Wait();
408 } 441 }
409 } 442 }
410 443
411 // TODO(akalin): Add tests exercising: 444 // TODO(akalin): Add tests exercising:
412 // - Offline installation/uninstallation behavior 445 // - Offline installation/uninstallation behavior
413 // - App-specific properties 446 // - App-specific properties
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698