| 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/sync/test/integration/autofill_helper.h" | 6 #include "chrome/browser/sync/test/integration/autofill_helper.h" |
| 7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" | 7 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" |
| 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 9 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 10 #include "components/autofill/core/browser/autofill_profile.h" | 10 #include "components/autofill/core/browser/autofill_profile.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 101 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 102 ASSERT_TRUE(KeysMatch(0, 1)); | 102 ASSERT_TRUE(KeysMatch(0, 1)); |
| 103 ASSERT_EQ(0U, GetAllKeys(0).size()); | 103 ASSERT_EQ(0U, GetAllKeys(0).size()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // TCM ID - 3678296. | 106 // TCM ID - 3678296. |
| 107 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { | 107 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) { |
| 108 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 108 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 109 | 109 |
| 110 std::set<AutofillKey> keys; | 110 std::set<AutofillKey> keys; |
| 111 keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"), | 111 keys.insert(AutofillKey(base::WideToUTF16(L"Sigur R\u00F3s"), |
| 112 WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); | 112 base::WideToUTF16(L"\u00C1g\u00E6tis byrjun"))); |
| 113 AddKeys(0, keys); | 113 AddKeys(0, keys); |
| 114 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 114 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 115 ASSERT_TRUE(AwaitQuiescence()); | 115 ASSERT_TRUE(AwaitQuiescence()); |
| 116 ASSERT_TRUE(KeysMatch(0, 1)); | 116 ASSERT_TRUE(KeysMatch(0, 1)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, | 119 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, |
| 120 AddDuplicateNamesToSameProfile) { | 120 AddDuplicateNamesToSameProfile) { |
| 121 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 121 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 122 | 122 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); | 181 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 182 MakeABookmarkChange(1); | 182 MakeABookmarkChange(1); |
| 183 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 183 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 184 ASSERT_TRUE(ProfilesMatch(0, 1)); | 184 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 185 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 185 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 186 | 186 |
| 187 // Client0 updates a profile. | 187 // Client0 updates a profile. |
| 188 UpdateProfile(0, | 188 UpdateProfile(0, |
| 189 GetAllProfiles(0)[0]->guid(), | 189 GetAllProfiles(0)[0]->guid(), |
| 190 AutofillType(autofill::NAME_FIRST), | 190 AutofillType(autofill::NAME_FIRST), |
| 191 ASCIIToUTF16("Bart")); | 191 base::ASCIIToUTF16("Bart")); |
| 192 MakeABookmarkChange(0); | 192 MakeABookmarkChange(0); |
| 193 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 193 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 194 ASSERT_TRUE(ProfilesMatch(0, 1)); | 194 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 195 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 195 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 196 | 196 |
| 197 // Client1 removes remaining profile. | 197 // Client1 removes remaining profile. |
| 198 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); | 198 RemoveProfile(1, GetAllProfiles(1)[0]->guid()); |
| 199 MakeABookmarkChange(1); | 199 MakeABookmarkChange(1); |
| 200 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); | 200 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
| 201 ASSERT_TRUE(ProfilesMatch(0, 1)); | 201 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 214 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 214 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 215 } | 215 } |
| 216 | 216 |
| 217 // TCM ID - 3636294. | 217 // TCM ID - 3636294. |
| 218 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { | 218 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) { |
| 219 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; | 219 ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; |
| 220 | 220 |
| 221 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); | 221 AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER); |
| 222 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); | 222 AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER); |
| 223 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, | 223 profile1.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, |
| 224 ASCIIToUTF16("1234567890")); | 224 base::ASCIIToUTF16("1234567890")); |
| 225 | 225 |
| 226 AddProfile(0, profile0); | 226 AddProfile(0, profile0); |
| 227 AddProfile(1, profile1); | 227 AddProfile(1, profile1); |
| 228 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 228 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 229 ASSERT_TRUE(AwaitQuiescence()); | 229 ASSERT_TRUE(AwaitQuiescence()); |
| 230 ASSERT_TRUE(ProfilesMatch(0, 1)); | 230 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 231 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 231 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 // TCM ID - 3626291. | 234 // TCM ID - 3626291. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 302 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 303 MakeABookmarkChange(0); | 303 MakeABookmarkChange(0); |
| 304 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 304 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 305 ASSERT_TRUE(ProfilesMatch(0, 1)); | 305 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 306 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 306 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 307 | 307 |
| 308 UpdateProfile(0, | 308 UpdateProfile(0, |
| 309 GetAllProfiles(0)[0]->guid(), | 309 GetAllProfiles(0)[0]->guid(), |
| 310 AutofillType(autofill::NAME_FIRST), | 310 AutofillType(autofill::NAME_FIRST), |
| 311 ASCIIToUTF16("Lisa")); | 311 base::ASCIIToUTF16("Lisa")); |
| 312 UpdateProfile(0, | 312 UpdateProfile(0, |
| 313 GetAllProfiles(0)[0]->guid(), | 313 GetAllProfiles(0)[0]->guid(), |
| 314 AutofillType(autofill::EMAIL_ADDRESS), | 314 AutofillType(autofill::EMAIL_ADDRESS), |
| 315 ASCIIToUTF16("grrrl@TV.com")); | 315 base::ASCIIToUTF16("grrrl@TV.com")); |
| 316 MakeABookmarkChange(0); | 316 MakeABookmarkChange(0); |
| 317 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 317 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 318 ASSERT_TRUE(ProfilesMatch(0, 1)); | 318 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 319 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 319 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 320 } | 320 } |
| 321 | 321 |
| 322 // TCM ID - 3628299. | 322 // TCM ID - 3628299. |
| 323 // This test is flaky on all platforms. See crbug.com/152551. | 323 // This test is flaky on all platforms. See crbug.com/152551. |
| 324 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DISABLED_ConflictingFields) { | 324 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DISABLED_ConflictingFields) { |
| 325 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 325 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 326 | 326 |
| 327 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 327 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 328 MakeABookmarkChange(0); | 328 MakeABookmarkChange(0); |
| 329 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 329 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 330 ASSERT_TRUE(ProfilesMatch(0, 1)); | 330 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 331 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 331 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 332 UpdateProfile(0, | 332 UpdateProfile(0, |
| 333 GetAllProfiles(0)[0]->guid(), | 333 GetAllProfiles(0)[0]->guid(), |
| 334 AutofillType(autofill::NAME_FIRST), | 334 AutofillType(autofill::NAME_FIRST), |
| 335 ASCIIToUTF16("Lisa")); | 335 base::ASCIIToUTF16("Lisa")); |
| 336 MakeABookmarkChange(0); | 336 MakeABookmarkChange(0); |
| 337 UpdateProfile(1, | 337 UpdateProfile(1, |
| 338 GetAllProfiles(1)[0]->guid(), | 338 GetAllProfiles(1)[0]->guid(), |
| 339 AutofillType(autofill::NAME_FIRST), | 339 AutofillType(autofill::NAME_FIRST), |
| 340 ASCIIToUTF16("Bart")); | 340 base::ASCIIToUTF16("Bart")); |
| 341 MakeABookmarkChange(1); | 341 MakeABookmarkChange(1); |
| 342 ASSERT_TRUE(AwaitQuiescence()); | 342 ASSERT_TRUE(AwaitQuiescence()); |
| 343 ASSERT_TRUE(ProfilesMatch(0, 1)); | 343 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 344 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 344 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 // TCM ID - 3663293. | 347 // TCM ID - 3663293. |
| 348 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) { | 348 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) { |
| 349 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 349 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 350 | 350 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 460 } |
| 461 | 461 |
| 462 // Test credit cards don't sync. | 462 // Test credit cards don't sync. |
| 463 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { | 463 IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, NoCreditCardSync) { |
| 464 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 464 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 465 | 465 |
| 466 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); | 466 AddProfile(0, CreateAutofillProfile(PROFILE_HOMER)); |
| 467 | 467 |
| 468 CreditCard card; | 468 CreditCard card; |
| 469 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, | 469 card.SetRawInfo(autofill::CREDIT_CARD_NUMBER, |
| 470 ASCIIToUTF16("6011111111111117")); | 470 base::ASCIIToUTF16("6011111111111117")); |
| 471 std::vector<CreditCard> credit_cards; | 471 std::vector<CreditCard> credit_cards; |
| 472 credit_cards.push_back(card); | 472 credit_cards.push_back(card); |
| 473 SetCreditCards(0, &credit_cards); | 473 SetCreditCards(0, &credit_cards); |
| 474 | 474 |
| 475 MakeABookmarkChange(0); | 475 MakeABookmarkChange(0); |
| 476 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); | 476 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
| 477 ASSERT_TRUE(ProfilesMatch(0, 1)); | 477 ASSERT_TRUE(ProfilesMatch(0, 1)); |
| 478 ASSERT_EQ(1U, GetAllProfiles(0).size()); | 478 ASSERT_EQ(1U, GetAllProfiles(0).size()); |
| 479 | 479 |
| 480 PersonalDataManager* pdm = GetPersonalDataManager(1); | 480 PersonalDataManager* pdm = GetPersonalDataManager(1); |
| 481 ASSERT_EQ(0U, pdm->GetCreditCards().size()); | 481 ASSERT_EQ(0U, pdm->GetCreditCards().size()); |
| 482 } | 482 } |
| OLD | NEW |