two_client_autofill_sync_test.cc revision e5d81f57cb97b3b6b7fccc9c5610d21eb81db09d
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 3// found in the LICENSE file. 4 5#include "base/strings/utf_string_conversions.h" 6#include "chrome/browser/sync/test/integration/autofill_helper.h" 7#include "chrome/browser/sync/test/integration/bookmarks_helper.h" 8#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 9#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 10#include "chrome/browser/sync/test/integration/sync_test.h" 11#include "components/autofill/core/browser/autofill_profile.h" 12#include "components/autofill/core/browser/credit_card.h" 13#include "components/autofill/core/browser/personal_data_manager.h" 14#include "components/autofill/core/browser/webdata/autofill_entry.h" 15#include "components/autofill/core/browser/webdata/autofill_table.h" 16 17using autofill::AutofillKey; 18using autofill::AutofillTable; 19using autofill::AutofillProfile; 20using autofill::AutofillType; 21using autofill::CreditCard; 22using autofill::PersonalDataManager; 23using autofill_helper::AddKeys; 24using autofill_helper::AddProfile; 25using autofill_helper::CreateAutofillProfile; 26using autofill_helper::GetAllKeys; 27using autofill_helper::GetAllProfiles; 28using autofill_helper::GetPersonalDataManager; 29using autofill_helper::KeysMatch; 30using autofill_helper::ProfilesMatch; 31using autofill_helper::PROFILE_FRASIER; 32using autofill_helper::PROFILE_HOMER; 33using autofill_helper::PROFILE_MARION; 34using autofill_helper::PROFILE_NULL; 35using autofill_helper::RemoveKey; 36using autofill_helper::RemoveProfile; 37using autofill_helper::SetCreditCards; 38using autofill_helper::UpdateProfile; 39using bookmarks_helper::AddFolder; 40using bookmarks_helper::AddURL; 41using bookmarks_helper::IndexedURL; 42using bookmarks_helper::IndexedURLTitle; 43using sync_integration_test_util::AwaitCommitActivityCompletion; 44 45class TwoClientAutofillSyncTest : public SyncTest { 46 public: 47 TwoClientAutofillSyncTest() : SyncTest(TWO_CLIENT) { count = 0; } 48 virtual ~TwoClientAutofillSyncTest() {} 49 50 // We do this so as to make a change that will trigger the autofill to sync. 51 // By default autofill does not sync unless there is some other change. 52 void MakeABookmarkChange(int profile) { 53 ASSERT_TRUE( 54 AddURL(profile, IndexedURLTitle(count), GURL(IndexedURL(count)))); 55 ++count; 56 } 57 private: 58 int count; 59 DISALLOW_COPY_AND_ASSIGN(TwoClientAutofillSyncTest); 60}; 61 62IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) { 63 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 64 65 // Client0 adds a key. 66 std::set<AutofillKey> keys; 67 keys.insert(AutofillKey("name0", "value0")); 68 AddKeys(0, keys); 69 MakeABookmarkChange(0); 70 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 71 ASSERT_TRUE(KeysMatch(0, 1)); 72 ASSERT_EQ(1U, GetAllKeys(0).size()); 73 74 // Client1 adds a key. 75 keys.clear(); 76 keys.insert(AutofillKey("name1", "value1-0")); 77 AddKeys(1, keys); 78 MakeABookmarkChange(1); 79 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 80 ASSERT_TRUE(KeysMatch(0, 1)); 81 ASSERT_EQ(2U, GetAllKeys(0).size()); 82 83 // Client0 adds a key with the same name. 84 keys.clear(); 85 keys.insert(AutofillKey("name1", "value1-1")); 86 AddKeys(0, keys); 87 MakeABookmarkChange(0); 88 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 89 ASSERT_TRUE(KeysMatch(0, 1)); 90 ASSERT_EQ(3U, GetAllKeys(0).size()); 91 92 // Client1 removes a key. 93 RemoveKey(1, AutofillKey("name1", "value1-0")); 94 MakeABookmarkChange(1); 95 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 96 ASSERT_TRUE(KeysMatch(0, 1)); 97 ASSERT_EQ(2U, GetAllKeys(0).size()); 98 99 // Client0 removes the rest. 100 RemoveKey(0, AutofillKey("name0", "value0")); 101 RemoveKey(0, AutofillKey("name1", "value1-1")); 102 MakeABookmarkChange(0); 103 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 104 ASSERT_TRUE(KeysMatch(0, 1)); 105 ASSERT_EQ(0U, GetAllKeys(0).size()); 106} 107 108// TCM ID - 3678296. 109IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { 110 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 111 112 std::set<AutofillKey> keys; 113 keys.insert(AutofillKey(base::WideToUTF16(L"Sigur R\u00F3s"), 114 base::WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); 115 AddKeys(0, keys); 116 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 117 ASSERT_TRUE(AwaitQuiescence()); 118 ASSERT_TRUE(KeysMatch(0, 1)); 119} 120 121IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, 122 AddDuplicateNamesToSameProfile) { 123 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 124 125 std::set<AutofillKey> keys; 126 keys.insert(AutofillKey("name0", "value0-0")); 127 keys.insert(AutofillKey("name0", "value0-1")); 128 keys.insert(AutofillKey("name1", "value1")); 129 AddKeys(0, keys); 130 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 131 ASSERT_TRUE(AwaitQuiescence()); 132 ASSERT_TRUE(KeysMatch(0, 1)); 133 ASSERT_EQ(2U, GetAllKeys(0).size()); 134} 135 136IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, 137 AddDuplicateNamesToDifferentProfiles) { 138 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 139 140 std::set<AutofillKey> keys0; 141 keys0.insert(AutofillKey("name0", "value0-0")); 142 keys0.insert(AutofillKey("name1", "value1")); 143 AddKeys(0, keys0); 144 145 std::set<AutofillKey> keys1; 146 keys1.insert(AutofillKey("name0", "value0-1")); 147 keys1.insert(AutofillKey("name2", "value2")); 148 keys1.insert(AutofillKey("name3", "value3")); 149 AddKeys(1, keys1); 150 151 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 152 ASSERT_TRUE(AwaitQuiescence()); 153 ASSERT_TRUE(KeysMatch(0, 1)); 154 ASSERT_EQ(5U, GetAllKeys(0).size()); 155} 156 157IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, 158 PersonalDataManagerSanity) { 159 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 160 161 // Client0 adds a profile. 162 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 163 MakeABookmarkChange(0); 164 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 165 ASSERT_TRUE(ProfilesMatch(0, 1)); 166 ASSERT_EQ(1U, GetAllProfiles(0).size()); 167 168 // Client1 adds a profile. 169 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); 170 MakeABookmarkChange(1); 171 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 172 ASSERT_TRUE(ProfilesMatch(0, 1)); 173 ASSERT_EQ(2U, GetAllProfiles(0).size()); 174 175 // Client0 adds the same profile. 176 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); 177 MakeABookmarkChange(0); 178 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 179 ASSERT_TRUE(ProfilesMatch(0, 1)); 180 ASSERT_EQ(2U, GetAllProfiles(0).size()); 181 182 // Client1 removes a profile. 183 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); 184 MakeABookmarkChange(1); 185 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 186 ASSERT_TRUE(ProfilesMatch(0, 1)); 187 ASSERT_EQ(1U, GetAllProfiles(0).size()); 188 189 // Client0 updates a profile. 190 UpdateProfile(0, 191 GetAllProfiles(0)[0]->guid(), 192 AutofillType(autofill::NAME_FIRST), 193 base::ASCIIToUTF16("Bart")); 194 MakeABookmarkChange(0); 195 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 196 ASSERT_TRUE(ProfilesMatch(0, 1)); 197 ASSERT_EQ(1U, GetAllProfiles(0).size()); 198 199 // Client1 removes remaining profile. 200 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); 201 MakeABookmarkChange(1); 202 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 203 ASSERT_TRUE(ProfilesMatch(0, 1)); 204 ASSERT_EQ(0U, GetAllProfiles(0).size()); 205} 206 207// TCM ID - 7261786. 208IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) { 209 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 210 211 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 212 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 213 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 214 ASSERT_TRUE(AwaitQuiescence()); 215 ASSERT_TRUE(ProfilesMatch(0, 1)); 216 ASSERT_EQ(1U, GetAllProfiles(0).size()); 217} 218 219// TCM ID - 3636294. 220IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { 221 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 222 223 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); 224 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); 225 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, 226 base::ASCIIToUTF16("1234567890")); 227 228 AddProfile(0, profile0); 229 AddProfile(1, profile1); 230 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 231 ASSERT_TRUE(AwaitQuiescence()); 232 ASSERT_TRUE(ProfilesMatch(0, 1)); 233 ASSERT_EQ(1U, GetAllProfiles(0).size()); 234} 235 236// TCM ID - 3626291. 237IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) { 238 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 239 240 AddProfile(0, CreateAutofillProfile(PROFILE_NULL)); 241 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 242 ASSERT_TRUE(ProfilesMatch(0, 1)); 243 ASSERT_EQ(0U, GetAllProfiles(0).size()); 244} 245 246// TCM ID - 3616283. 247IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) { 248 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 249 250 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 251 MakeABookmarkChange(0); 252 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 253 ASSERT_TRUE(ProfilesMatch(0, 1)); 254 ASSERT_EQ(1U, GetAllProfiles(0).size()); 255} 256 257// TCM ID - 3632260. 258IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) { 259 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 260 261 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 262 AddProfile(0, CreateAutofillProfile(PROFILE_MARION)); 263 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); 264 MakeABookmarkChange(0); 265 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 266 ASSERT_TRUE(ProfilesMatch(0, 1)); 267 ASSERT_EQ(3U, GetAllProfiles(0).size()); 268} 269 270// TCM ID - 3602257. 271IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) { 272 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 273 274 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 275 MakeABookmarkChange(0); 276 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 277 ASSERT_TRUE(ProfilesMatch(0, 1)); 278 ASSERT_EQ(1U, GetAllProfiles(0).size()); 279 280 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); 281 MakeABookmarkChange(1); 282 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 283 ASSERT_TRUE(ProfilesMatch(0, 1)); 284 ASSERT_EQ(0U, GetAllProfiles(0).size()); 285} 286 287// TCM ID - 3627300. 288IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) { 289 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; 290 291 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 292 AddProfile(1, CreateAutofillProfile(PROFILE_MARION)); 293 AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER)); 294 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 295 ASSERT_TRUE(AwaitQuiescence()); 296 ASSERT_TRUE(ProfilesMatch(0, 1)); 297 ASSERT_EQ(3U, GetAllProfiles(0).size()); 298} 299 300// TCM ID - 3665264. 301IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) { 302 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 303 304 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 305 MakeABookmarkChange(0); 306 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 307 ASSERT_TRUE(ProfilesMatch(0, 1)); 308 ASSERT_EQ(1U, GetAllProfiles(0).size()); 309 310 UpdateProfile(0, 311 GetAllProfiles(0)[0]->guid(), 312 AutofillType(autofill::NAME_FIRST), 313 base::ASCIIToUTF16("Lisa")); 314 UpdateProfile(0, 315 GetAllProfiles(0)[0]->guid(), 316 AutofillType(autofill::EMAIL_ADDRESS), 317 base::ASCIIToUTF16("grrrl@TV.com")); 318 MakeABookmarkChange(0); 319 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 320 ASSERT_TRUE(ProfilesMatch(0, 1)); 321 ASSERT_EQ(1U, GetAllProfiles(0).size()); 322} 323 324// TCM ID - 3628299. 325// This test is flaky on all platforms. See crbug.com/152551. 326IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DISABLED_ConflictingFields) { 327 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 328 329 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 330 MakeABookmarkChange(0); 331 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 332 ASSERT_TRUE(ProfilesMatch(0, 1)); 333 ASSERT_EQ(1U, GetAllProfiles(0).size()); 334 UpdateProfile(0, 335 GetAllProfiles(0)[0]->guid(), 336 AutofillType(autofill::NAME_FIRST), 337 base::ASCIIToUTF16("Lisa")); 338 MakeABookmarkChange(0); 339 UpdateProfile(1, 340 GetAllProfiles(1)[0]->guid(), 341 AutofillType(autofill::NAME_FIRST), 342 base::ASCIIToUTF16("Bart")); 343 MakeABookmarkChange(1); 344 ASSERT_TRUE(AwaitQuiescence()); 345 ASSERT_TRUE(ProfilesMatch(0, 1)); 346 ASSERT_EQ(1U, GetAllProfiles(0).size()); 347} 348 349// TCM ID - 3663293. 350IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) { 351 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 352 353 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 354 MakeABookmarkChange(0); 355 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 356 ASSERT_TRUE(ProfilesMatch(0, 1)); 357 ASSERT_EQ(1U, GetAllProfiles(0).size()); 358 359 ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncer::AUTOFILL)); 360 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); 361 MakeABookmarkChange(0); 362 ASSERT_TRUE(AwaitQuiescence()); 363 ASSERT_FALSE(ProfilesMatch(0, 1)); 364 ASSERT_EQ(2U, GetAllProfiles(0).size()); 365 ASSERT_EQ(1U, GetAllProfiles(1).size()); 366 367 ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncer::AUTOFILL)); 368 MakeABookmarkChange(0); 369 ASSERT_TRUE(AwaitQuiescence()); 370 ASSERT_TRUE(ProfilesMatch(0, 1)); 371 ASSERT_EQ(2U, GetAllProfiles(0).size()); 372} 373 374// TCM ID - 3661291. 375IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) { 376 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 377 378 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 379 MakeABookmarkChange(0); 380 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 381 ASSERT_TRUE(ProfilesMatch(0, 1)); 382 ASSERT_EQ(1U, GetAllProfiles(0).size()); 383 384 ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes()); 385 AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER)); 386 MakeABookmarkChange(0); 387 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); 388 ASSERT_FALSE(ProfilesMatch(0, 1)); 389 ASSERT_EQ(2U, GetAllProfiles(0).size()); 390 ASSERT_EQ(1U, GetAllProfiles(1).size()); 391 392 ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes()); 393 ASSERT_TRUE(AwaitQuiescence()); 394 ASSERT_TRUE(ProfilesMatch(0, 1)); 395 ASSERT_EQ(2U, GetAllProfiles(0).size()); 396} 397 398// TCM ID - 3608295. 399IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) { 400 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 401 402 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 403 MakeABookmarkChange(0); 404 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 405 ASSERT_TRUE(ProfilesMatch(0, 1)); 406 ASSERT_EQ(1U, GetAllProfiles(0).size()); 407 408 base::string16 max_length_string(AutofillTable::kMaxDataLength, '.'); 409 UpdateProfile(0, 410 GetAllProfiles(0)[0]->guid(), 411 AutofillType(autofill::NAME_FIRST), 412 max_length_string); 413 UpdateProfile(0, 414 GetAllProfiles(0)[0]->guid(), 415 AutofillType(autofill::NAME_LAST), 416 max_length_string); 417 UpdateProfile(0, 418 GetAllProfiles(0)[0]->guid(), 419 AutofillType(autofill::EMAIL_ADDRESS), 420 max_length_string); 421 UpdateProfile(0, 422 GetAllProfiles(0)[0]->guid(), 423 AutofillType(autofill::ADDRESS_HOME_LINE1), 424 max_length_string); 425 426 MakeABookmarkChange(0); 427 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 428 ASSERT_TRUE(ProfilesMatch(0, 1)); 429} 430 431IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ExceedsMaxLength) { 432 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 433 434 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 435 MakeABookmarkChange(0); 436 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 437 ASSERT_TRUE(ProfilesMatch(0, 1)); 438 ASSERT_EQ(1U, GetAllProfiles(0).size()); 439 440 base::string16 exceeds_max_length_string( 441 AutofillTable::kMaxDataLength + 1, '.'); 442 UpdateProfile(0, 443 GetAllProfiles(0)[0]->guid(), 444 AutofillType(autofill::NAME_FIRST), 445 exceeds_max_length_string); 446 UpdateProfile(0, 447 GetAllProfiles(0)[0]->guid(), 448 AutofillType(autofill::NAME_LAST), 449 exceeds_max_length_string); 450 UpdateProfile(0, 451 GetAllProfiles(0)[0]->guid(), 452 AutofillType(autofill::EMAIL_ADDRESS), 453 exceeds_max_length_string); 454 UpdateProfile(0, 455 GetAllProfiles(0)[0]->guid(), 456 AutofillType(autofill::ADDRESS_HOME_LINE1), 457 exceeds_max_length_string); 458 459 MakeABookmarkChange(0); 460 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 461 ASSERT_FALSE(ProfilesMatch(0, 1)); 462} 463 464// Test credit cards don't sync. 465IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { 466 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 467 468 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); 469 470 CreditCard card; 471 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, 472 base::ASCIIToUTF16("6011111111111117")); 473 std::vector<CreditCard> credit_cards; 474 credit_cards.push_back(card); 475 SetCreditCards(0, &credit_cards); 476 477 MakeABookmarkChange(0); 478 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 479 ASSERT_TRUE(ProfilesMatch(0, 1)); 480 ASSERT_EQ(1U, GetAllProfiles(0).size()); 481 482 PersonalDataManager* pdm = GetPersonalDataManager(1); 483 ASSERT_EQ(0U, pdm->GetCreditCards().size()); 484} 485