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

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

Issue 1851243002: [Sync] Eliminate verifier profile from sync_integration_tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not remove AwaitQuiescence() 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
« no previous file with comments | « chrome/browser/sync/test/integration/two_client_apps_sync_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/sync/test/integration/autofill_helper.h" 7 #include "chrome/browser/sync/test/integration/autofill_helper.h"
8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
10 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 10 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
(...skipping 10 matching lines...) Expand all
21 using autofill::AutofillProfile; 21 using autofill::AutofillProfile;
22 using autofill::AutofillType; 22 using autofill::AutofillType;
23 using autofill::CreditCard; 23 using autofill::CreditCard;
24 using autofill::PersonalDataManager; 24 using autofill::PersonalDataManager;
25 using autofill_helper::AddKeys; 25 using autofill_helper::AddKeys;
26 using autofill_helper::AddProfile; 26 using autofill_helper::AddProfile;
27 using autofill_helper::AwaitKeysMatch; 27 using autofill_helper::AwaitKeysMatch;
28 using autofill_helper::AwaitProfilesMatch; 28 using autofill_helper::AwaitProfilesMatch;
29 using autofill_helper::CreateAutofillProfile; 29 using autofill_helper::CreateAutofillProfile;
30 using autofill_helper::CreateUniqueAutofillProfile; 30 using autofill_helper::CreateUniqueAutofillProfile;
31 using autofill_helper::GetAllAutoFillProfiles;
31 using autofill_helper::GetAllKeys; 32 using autofill_helper::GetAllKeys;
32 using autofill_helper::GetAllProfiles;
33 using autofill_helper::GetPersonalDataManager; 33 using autofill_helper::GetPersonalDataManager;
34 using autofill_helper::GetProfileCount; 34 using autofill_helper::GetProfileCount;
35 using autofill_helper::KeysMatch; 35 using autofill_helper::KeysMatch;
36 using autofill_helper::ProfilesMatch; 36 using autofill_helper::ProfilesMatch;
37 using autofill_helper::PROFILE_FRASIER; 37 using autofill_helper::PROFILE_FRASIER;
38 using autofill_helper::PROFILE_HOMER; 38 using autofill_helper::PROFILE_HOMER;
39 using autofill_helper::PROFILE_MARION; 39 using autofill_helper::PROFILE_MARION;
40 using autofill_helper::PROFILE_NULL; 40 using autofill_helper::PROFILE_NULL;
41 using autofill_helper::RemoveKey; 41 using autofill_helper::RemoveKey;
42 using autofill_helper::RemoveProfile; 42 using autofill_helper::RemoveProfile;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, 157 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
158 PersonalDataManagerSanity) { 158 PersonalDataManagerSanity) {
159 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 159 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
160 160
161 // Client0 adds a profile. 161 // Client0 adds a profile.
162 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 162 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
163 MakeABookmarkChange(0); 163 MakeABookmarkChange(0);
164 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 164 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
165 ASSERT_EQ(1U, GetAllProfiles(0).size()); 165 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
166 166
167 // Client1 adds a profile. 167 // Client1 adds a profile.
168 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); 168 AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
169 MakeABookmarkChange(1); 169 MakeABookmarkChange(1);
170 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 170 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
171 ASSERT_EQ(2U, GetAllProfiles(0).size()); 171 ASSERT_EQ(2U, GetAllAutoFillProfiles(0).size());
172 172
173 // Client0 adds the same profile. 173 // Client0 adds the same profile.
174 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); 174 AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
175 MakeABookmarkChange(0); 175 MakeABookmarkChange(0);
176 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 176 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
177 ASSERT_EQ(2U, GetAllProfiles(0).size()); 177 ASSERT_EQ(2U, GetAllAutoFillProfiles(0).size());
178 178
179 // Client1 removes a profile. 179 // Client1 removes a profile.
180 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); 180 RemoveProfile(1, GetAllAutoFillProfiles(1)[0]->guid());
181 MakeABookmarkChange(1); 181 MakeABookmarkChange(1);
182 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 182 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
183 ASSERT_EQ(1U, GetAllProfiles(0).size()); 183 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
184 184
185 // Client0 updates a profile. 185 // Client0 updates a profile.
186 UpdateProfile(0, 186 UpdateProfile(0,
187 GetAllProfiles(0)[0]->guid(), 187 GetAllAutoFillProfiles(0)[0]->guid(),
188 AutofillType(autofill::NAME_FIRST), 188 AutofillType(autofill::NAME_FIRST),
189 base::ASCIIToUTF16("Bart")); 189 base::ASCIIToUTF16("Bart"));
190 MakeABookmarkChange(0); 190 MakeABookmarkChange(0);
191 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 191 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
192 ASSERT_EQ(1U, GetAllProfiles(0).size()); 192 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
193 193
194 // Client1 removes remaining profile. 194 // Client1 removes remaining profile.
195 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); 195 RemoveProfile(1, GetAllAutoFillProfiles(1)[0]->guid());
196 MakeABookmarkChange(1); 196 MakeABookmarkChange(1);
197 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 197 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
198 ASSERT_EQ(0U, GetAllProfiles(0).size()); 198 ASSERT_EQ(0U, GetAllAutoFillProfiles(0).size());
199 } 199 }
200 200
201 // TCM ID - 7261786. 201 // TCM ID - 7261786.
202 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { 202 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) {
203 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 203 ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
204 204
205 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 205 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
206 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 206 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
207 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 207 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
208 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 208 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
209 ASSERT_EQ(1U, GetAllProfiles(0).size()); 209 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
210 } 210 }
211 211
212 // TCM ID - 3636294. 212 // TCM ID - 3636294.
213 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { 213 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) {
214 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 214 ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
215 215
216 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); 216 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER);
217 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); 217 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER);
218 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, 218 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER,
219 base::ASCIIToUTF16("1234567890")); 219 base::ASCIIToUTF16("1234567890"));
220 220
221 AddProfile(0, profile0); 221 AddProfile(0, profile0);
222 AddProfile(1, profile1); 222 AddProfile(1, profile1);
223 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 223 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
224 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 224 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
225 ASSERT_EQ(1U, GetAllProfiles(0).size()); 225 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
226 } 226 }
227 227
228 // TCM ID - 3626291. 228 // TCM ID - 3626291.
229 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { 229 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) {
230 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 230 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
231 231
232 AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); 232 AddProfile(0, CreateAutofillProfile(PROFILE_NULL));
233 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 233 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
234 ASSERT_EQ(0U, GetAllProfiles(0).size()); 234 ASSERT_EQ(0U, GetAllAutoFillProfiles(0).size());
235 } 235 }
236 236
237 // TCM ID - 3616283. 237 // TCM ID - 3616283.
238 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { 238 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) {
239 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 239 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
240 240
241 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 241 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
242 MakeABookmarkChange(0); 242 MakeABookmarkChange(0);
243 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 243 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
244 ASSERT_EQ(1U, GetAllProfiles(0).size()); 244 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
245 } 245 }
246 246
247 // TCM ID - 3632260. 247 // TCM ID - 3632260.
248 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { 248 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) {
249 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 249 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
250 250
251 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 251 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
252 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); 252 AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
253 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); 253 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
254 MakeABookmarkChange(0); 254 MakeABookmarkChange(0);
255 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 255 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
256 ASSERT_EQ(3U, GetAllProfiles(0).size()); 256 ASSERT_EQ(3U, GetAllAutoFillProfiles(0).size());
257 } 257 }
258 258
259 // TCM ID - 3602257. 259 // TCM ID - 3602257.
260 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { 260 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) {
261 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 261 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
262 262
263 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 263 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
264 MakeABookmarkChange(0); 264 MakeABookmarkChange(0);
265 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 265 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
266 ASSERT_EQ(1U, GetAllProfiles(0).size()); 266 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
267 267
268 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); 268 RemoveProfile(1, GetAllAutoFillProfiles(1)[0]->guid());
269 MakeABookmarkChange(1); 269 MakeABookmarkChange(1);
270 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 270 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
271 ASSERT_EQ(0U, GetAllProfiles(0).size()); 271 ASSERT_EQ(0U, GetAllAutoFillProfiles(0).size());
272 } 272 }
273 273
274 // TCM ID - 3627300. 274 // TCM ID - 3627300.
275 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { 275 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) {
276 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 276 ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
277 277
278 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 278 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
279 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); 279 AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
280 AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER)); 280 AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER));
281 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 281 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
282 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 282 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
283 ASSERT_EQ(3U, GetAllProfiles(0).size()); 283 ASSERT_EQ(3U, GetAllAutoFillProfiles(0).size());
284 } 284 }
285 285
286 // TCM ID - 3665264. 286 // TCM ID - 3665264.
287 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { 287 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) {
288 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 288 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
289 289
290 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 290 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
291 MakeABookmarkChange(0); 291 MakeABookmarkChange(0);
292 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 292 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
293 ASSERT_EQ(1U, GetAllProfiles(0).size()); 293 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
294 294
295 UpdateProfile(0, 295 UpdateProfile(0,
296 GetAllProfiles(0)[0]->guid(), 296 GetAllAutoFillProfiles(0)[0]->guid(),
297 AutofillType(autofill::NAME_FIRST), 297 AutofillType(autofill::NAME_FIRST),
298 base::ASCIIToUTF16("Lisa")); 298 base::ASCIIToUTF16("Lisa"));
299 UpdateProfile(0, 299 UpdateProfile(0,
300 GetAllProfiles(0)[0]->guid(), 300 GetAllAutoFillProfiles(0)[0]->guid(),
301 AutofillType(autofill::EMAIL_ADDRESS), 301 AutofillType(autofill::EMAIL_ADDRESS),
302 base::ASCIIToUTF16("grrrl@TV.com")); 302 base::ASCIIToUTF16("grrrl@TV.com"));
303 MakeABookmarkChange(0); 303 MakeABookmarkChange(0);
304 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 304 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
305 ASSERT_EQ(1U, GetAllProfiles(0).size()); 305 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
306 } 306 }
307 307
308 // TCM ID - 3628299. 308 // TCM ID - 3628299.
309 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) { 309 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) {
310 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 310 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
311 311
312 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 312 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
313 MakeABookmarkChange(0); 313 MakeABookmarkChange(0);
314 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 314 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
315 ASSERT_EQ(1U, GetAllProfiles(0).size()); 315 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
316 UpdateProfile(0, 316 UpdateProfile(0,
317 GetAllProfiles(0)[0]->guid(), 317 GetAllAutoFillProfiles(0)[0]->guid(),
318 AutofillType(autofill::NAME_FIRST), 318 AutofillType(autofill::NAME_FIRST),
319 base::ASCIIToUTF16("Lisa")); 319 base::ASCIIToUTF16("Lisa"));
320 MakeABookmarkChange(0); 320 MakeABookmarkChange(0);
321 UpdateProfile(1, 321 UpdateProfile(1,
322 GetAllProfiles(1)[0]->guid(), 322 GetAllAutoFillProfiles(1)[0]->guid(),
323 AutofillType(autofill::NAME_FIRST), 323 AutofillType(autofill::NAME_FIRST),
324 base::ASCIIToUTF16("Bart")); 324 base::ASCIIToUTF16("Bart"));
325 MakeABookmarkChange(1); 325 MakeABookmarkChange(1);
326 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 326 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
327 ASSERT_EQ(1U, GetAllProfiles(0).size()); 327 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
328 } 328 }
329 329
330 // TCM ID - 3608295. 330 // TCM ID - 3608295.
331 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { 331 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) {
332 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 332 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
333 333
334 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 334 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
335 MakeABookmarkChange(0); 335 MakeABookmarkChange(0);
336 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 336 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
337 ASSERT_EQ(1U, GetAllProfiles(0).size()); 337 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
338 338
339 base::string16 max_length_string(AutofillTable::kMaxDataLength, '.'); 339 base::string16 max_length_string(AutofillTable::kMaxDataLength, '.');
340 UpdateProfile(0, 340 UpdateProfile(0,
341 GetAllProfiles(0)[0]->guid(), 341 GetAllAutoFillProfiles(0)[0]->guid(),
342 AutofillType(autofill::NAME_FULL), 342 AutofillType(autofill::NAME_FULL),
343 max_length_string); 343 max_length_string);
344 UpdateProfile(0, 344 UpdateProfile(0,
345 GetAllProfiles(0)[0]->guid(), 345 GetAllAutoFillProfiles(0)[0]->guid(),
346 AutofillType(autofill::EMAIL_ADDRESS), 346 AutofillType(autofill::EMAIL_ADDRESS),
347 max_length_string); 347 max_length_string);
348 UpdateProfile(0, 348 UpdateProfile(0,
349 GetAllProfiles(0)[0]->guid(), 349 GetAllAutoFillProfiles(0)[0]->guid(),
350 AutofillType(autofill::ADDRESS_HOME_LINE1), 350 AutofillType(autofill::ADDRESS_HOME_LINE1),
351 max_length_string); 351 max_length_string);
352 352
353 MakeABookmarkChange(0); 353 MakeABookmarkChange(0);
354 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 354 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
355 } 355 }
356 356
357 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { 357 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) {
358 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 358 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
359 359
360 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 360 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
361 MakeABookmarkChange(0); 361 MakeABookmarkChange(0);
362 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 362 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
363 ASSERT_EQ(1U, GetAllProfiles(0).size()); 363 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
364 364
365 base::string16 exceeds_max_length_string( 365 base::string16 exceeds_max_length_string(
366 AutofillTable::kMaxDataLength + 1, '.'); 366 AutofillTable::kMaxDataLength + 1, '.');
367 UpdateProfile(0, 367 UpdateProfile(0,
368 GetAllProfiles(0)[0]->guid(), 368 GetAllAutoFillProfiles(0)[0]->guid(),
369 AutofillType(autofill::NAME_FIRST), 369 AutofillType(autofill::NAME_FIRST),
370 exceeds_max_length_string); 370 exceeds_max_length_string);
371 UpdateProfile(0, 371 UpdateProfile(0,
372 GetAllProfiles(0)[0]->guid(), 372 GetAllAutoFillProfiles(0)[0]->guid(),
373 AutofillType(autofill::NAME_LAST), 373 AutofillType(autofill::NAME_LAST),
374 exceeds_max_length_string); 374 exceeds_max_length_string);
375 UpdateProfile(0, 375 UpdateProfile(0,
376 GetAllProfiles(0)[0]->guid(), 376 GetAllAutoFillProfiles(0)[0]->guid(),
377 AutofillType(autofill::EMAIL_ADDRESS), 377 AutofillType(autofill::EMAIL_ADDRESS),
378 exceeds_max_length_string); 378 exceeds_max_length_string);
379 UpdateProfile(0, 379 UpdateProfile(0,
380 GetAllProfiles(0)[0]->guid(), 380 GetAllAutoFillProfiles(0)[0]->guid(),
381 AutofillType(autofill::ADDRESS_HOME_LINE1), 381 AutofillType(autofill::ADDRESS_HOME_LINE1),
382 exceeds_max_length_string); 382 exceeds_max_length_string);
383 383
384 MakeABookmarkChange(0); 384 MakeABookmarkChange(0);
385 ASSERT_TRUE(bookmarks_helper::AwaitAllModelsMatch()); 385 ASSERT_TRUE(bookmarks_helper::AwaitAllModelsMatch());
386 EXPECT_FALSE(ProfilesMatch(0, 1)); 386 EXPECT_FALSE(ProfilesMatch(0, 1));
387 } 387 }
388 388
389 // Test credit cards don't sync. 389 // Test credit cards don't sync.
390 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { 390 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) {
391 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 391 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
392 392
393 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 393 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
394 394
395 CreditCard card; 395 CreditCard card;
396 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, 396 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER,
397 base::ASCIIToUTF16("6011111111111117")); 397 base::ASCIIToUTF16("6011111111111117"));
398 std::vector<CreditCard> credit_cards; 398 std::vector<CreditCard> credit_cards;
399 credit_cards.push_back(card); 399 credit_cards.push_back(card);
400 SetCreditCards(0, &credit_cards); 400 SetCreditCards(0, &credit_cards);
401 401
402 MakeABookmarkChange(0); 402 MakeABookmarkChange(0);
403 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 403 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
404 ASSERT_EQ(1U, GetAllProfiles(0).size()); 404 ASSERT_EQ(1U, GetAllAutoFillProfiles(0).size());
405 405
406 PersonalDataManager* pdm = GetPersonalDataManager(1); 406 PersonalDataManager* pdm = GetPersonalDataManager(1);
407 ASSERT_EQ(0U, pdm->GetCreditCards().size()); 407 ASSERT_EQ(0U, pdm->GetCreditCards().size());
408 } 408 }
409 409
410 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, 410 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
411 E2E_ONLY(TwoClientsAddAutofillProfiles)) { 411 E2E_ONLY(TwoClientsAddAutofillProfiles)) {
412 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 412 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
413 413
414 // All profiles should sync same autofill profiles. 414 // All profiles should sync same autofill profiles.
415 ASSERT_TRUE(AwaitProfilesMatch(0, 1)) << 415 ASSERT_TRUE(AwaitProfilesMatch(0, 1)) <<
416 "Initial autofill profiles did not match for all profiles."; 416 "Initial autofill profiles did not match for all profiles.";
417 417
418 // For clean profiles, the autofill profiles count should be zero. We are not 418 // For clean profiles, the autofill profiles count should be zero. We are not
419 // enforcing this, we only check that the final count is equal to initial 419 // enforcing this, we only check that the final count is equal to initial
420 // count plus new autofill profiles count. 420 // count plus new autofill profiles count.
421 int init_autofill_profiles_count = GetProfileCount(0); 421 int init_autofill_profiles_count = GetProfileCount(0);
422 422
423 // Add a new autofill profile to the first client. 423 // Add a new autofill profile to the first client.
424 AddProfile(0, CreateUniqueAutofillProfile()); 424 AddProfile(0, CreateUniqueAutofillProfile());
425 425
426 ASSERT_TRUE(AwaitProfilesMatch(0, 1)); 426 ASSERT_TRUE(AwaitProfilesMatch(0, 1));
427 427
428 // Check that the total number of autofill profiles is as expected 428 // Check that the total number of autofill profiles is as expected
429 for (int i = 0; i < num_clients(); ++i) { 429 for (int i = 0; i < num_clients(); ++i) {
430 ASSERT_EQ(GetProfileCount(i), init_autofill_profiles_count + 1) << 430 ASSERT_EQ(GetProfileCount(i), init_autofill_profiles_count + 1) <<
431 "Total autofill profile count is wrong."; 431 "Total autofill profile count is wrong.";
432 } 432 }
433 } 433 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/two_client_apps_sync_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698