| Index: chrome/test/live_sync/two_client_autofill_sync_test.cc
|
| diff --git a/chrome/test/live_sync/two_client_autofill_sync_test.cc b/chrome/test/live_sync/two_client_autofill_sync_test.cc
|
| index 9925e46acb6e3404922cb1bae1c508adc937a569..6e5c46cb1742b06018c3220f23a39520242e623d 100644
|
| --- a/chrome/test/live_sync/two_client_autofill_sync_test.cc
|
| +++ b/chrome/test/live_sync/two_client_autofill_sync_test.cc
|
| @@ -8,6 +8,21 @@
|
| #include "chrome/test/live_sync/autofill_helper.h"
|
| #include "chrome/test/live_sync/live_sync_test.h"
|
|
|
| +using autofill_helper::AddKeys;
|
| +using autofill_helper::AddProfile;
|
| +using autofill_helper::CreateAutofillProfile;
|
| +using autofill_helper::GetAllKeys;
|
| +using autofill_helper::GetAllProfiles;
|
| +using autofill_helper::KeysMatch;
|
| +using autofill_helper::ProfilesMatch;
|
| +using autofill_helper::PROFILE_FRASIER;
|
| +using autofill_helper::PROFILE_HOMER;
|
| +using autofill_helper::PROFILE_MARION;
|
| +using autofill_helper::PROFILE_NULL;
|
| +using autofill_helper::RemoveKey;
|
| +using autofill_helper::RemoveProfile;
|
| +using autofill_helper::UpdateProfile;
|
| +
|
| // Autofill entry length is limited to 1024. See http://crbug.com/49332.
|
| const size_t kMaxDataLength = 1024;
|
|
|
| @@ -26,39 +41,39 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, WebDataServiceSanity) {
|
| // Client0 adds a key.
|
| std::set<AutofillKey> keys;
|
| keys.insert(AutofillKey("name0", "value0"));
|
| - AutofillHelper::AddKeys(0, keys);
|
| + AddKeys(0, keys);
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllKeys(0).size());
|
|
|
| // Client1 adds a key.
|
| keys.clear();
|
| keys.insert(AutofillKey("name1", "value1-0"));
|
| - AutofillHelper::AddKeys(1, keys);
|
| + AddKeys(1, keys);
|
| ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllKeys(0).size());
|
|
|
| // Client0 adds a key with the same name.
|
| keys.clear();
|
| keys.insert(AutofillKey("name1", "value1-1"));
|
| - AutofillHelper::AddKeys(0, keys);
|
| + AddKeys(0, keys);
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(3U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(3U, GetAllKeys(0).size());
|
|
|
| // Client1 removes a key.
|
| - AutofillHelper::RemoveKey(1, AutofillKey("name1", "value1-0"));
|
| + RemoveKey(1, AutofillKey("name1", "value1-0"));
|
| ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllKeys(0).size());
|
|
|
| // Client0 removes the rest.
|
| - AutofillHelper::RemoveKey(0, AutofillKey("name0", "value0"));
|
| - AutofillHelper::RemoveKey(0, AutofillKey("name1", "value1-1"));
|
| + RemoveKey(0, AutofillKey("name0", "value0"));
|
| + RemoveKey(0, AutofillKey("name1", "value1-1"));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(0U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(0U, GetAllKeys(0).size());
|
| }
|
|
|
| // TCM ID - 3678296.
|
| @@ -68,10 +83,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddUnicodeProfile) {
|
| std::set<AutofillKey> keys;
|
| keys.insert(AutofillKey(WideToUTF16(L"Sigur R\u00F3s"),
|
| WideToUTF16(L"\u00C1g\u00E6tis byrjun")));
|
| - AutofillHelper::AddKeys(0, keys);
|
| + AddKeys(0, keys);
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
|
| @@ -82,11 +97,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
|
| keys.insert(AutofillKey("name0", "value0-0"));
|
| keys.insert(AutofillKey("name0", "value0-1"));
|
| keys.insert(AutofillKey("name1", "value1"));
|
| - AutofillHelper::AddKeys(0, keys);
|
| + AddKeys(0, keys);
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllKeys(0).size());
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
|
| @@ -96,18 +111,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
|
| std::set<AutofillKey> keys0;
|
| keys0.insert(AutofillKey("name0", "value0-0"));
|
| keys0.insert(AutofillKey("name1", "value1"));
|
| - AutofillHelper::AddKeys(0, keys0);
|
| + AddKeys(0, keys0);
|
|
|
| std::set<AutofillKey> keys1;
|
| keys1.insert(AutofillKey("name0", "value0-1"));
|
| keys1.insert(AutofillKey("name2", "value2"));
|
| keys1.insert(AutofillKey("name3", "value3"));
|
| - AutofillHelper::AddKeys(1, keys1);
|
| + AddKeys(1, keys1);
|
|
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::KeysMatch(0, 1));
|
| - ASSERT_EQ(5U, AutofillHelper::GetAllKeys(0).size());
|
| + ASSERT_TRUE(KeysMatch(0, 1));
|
| + ASSERT_EQ(5U, GetAllKeys(0).size());
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
|
| @@ -115,288 +130,249 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest,
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| // Client0 adds a profile.
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| // Client1 adds a profile.
|
| - AutofillHelper::AddProfile(
|
| - 1, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION));
|
| + AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
|
| ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllProfiles(0).size());
|
|
|
| // Client0 adds the same profile.
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllProfiles(0).size());
|
|
|
| // Client1 removes a profile.
|
| - AutofillHelper::RemoveProfile(
|
| - 1, AutofillHelper::GetAllProfiles(1)[0]->guid());
|
| + RemoveProfile(1, GetAllProfiles(1)[0]->guid());
|
| ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| // Client0 updates a profile.
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_FIRST),
|
| - ASCIIToUTF16("Bart"));
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_FIRST),
|
| + ASCIIToUTF16("Bart"));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| // Client1 removes remaining profile.
|
| - AutofillHelper::RemoveProfile(
|
| - 1, AutofillHelper::GetAllProfiles(1)[0]->guid());
|
| + RemoveProfile(1, GetAllProfiles(1)[0]->guid());
|
| ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(0U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(0U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 7261786.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddDuplicateProfiles) {
|
| ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3636294.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, SameProfileWithConflict) {
|
| ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
|
|
|
| - AutofillProfile profile0 =
|
| - AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER);
|
| - AutofillProfile profile1 =
|
| - AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER);
|
| + AutofillProfile profile0 = CreateAutofillProfile(PROFILE_HOMER);
|
| + AutofillProfile profile1 = CreateAutofillProfile(PROFILE_HOMER);
|
| profile1.SetInfo(PHONE_FAX_WHOLE_NUMBER, ASCIIToUTF16("1234567890"));
|
|
|
| - AutofillHelper::AddProfile(0, profile0);
|
| - AutofillHelper::AddProfile(1, profile1);
|
| + AddProfile(0, profile0);
|
| + AddProfile(1, profile1);
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3626291.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddEmptyProfile) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_NULL));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_NULL));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(0U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(0U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3616283.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddProfile) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3632260.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, AddMultipleProfiles) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION));
|
| - AutofillHelper::AddProfile(
|
| - 0,
|
| - AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_MARION));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(3U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(3U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3602257.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DeleteProfile) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| - AutofillHelper::RemoveProfile(
|
| - 1, AutofillHelper::GetAllProfiles(1)[0]->guid());
|
| + RemoveProfile(1, GetAllProfiles(1)[0]->guid());
|
| ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(0U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(0U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3627300.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MergeProfiles) {
|
| ASSERT_TRUE(SetupClients()) << "SetupClients() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| - AutofillHelper::AddProfile(
|
| - 1, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_MARION));
|
| - AutofillHelper::AddProfile(
|
| - 1,
|
| - AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| + AddProfile(1, CreateAutofillProfile(PROFILE_MARION));
|
| + AddProfile(1, CreateAutofillProfile(PROFILE_FRASIER));
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(3U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(3U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3665264.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, UpdateFields) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| -
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_FIRST),
|
| - ASCIIToUTF16("Lisa"));
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(EMAIL_ADDRESS),
|
| - ASCIIToUTF16("grrrl@TV.com"));
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| +
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_FIRST),
|
| + ASCIIToUTF16("Lisa"));
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(EMAIL_ADDRESS),
|
| + ASCIIToUTF16("grrrl@TV.com"));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3628299.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, ConflictingFields) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_FIRST),
|
| - ASCIIToUTF16("Lisa"));
|
| - AutofillHelper::UpdateProfile(
|
| - 1,
|
| - AutofillHelper::GetAllProfiles(1)[0]->guid(),
|
| - AutofillType(NAME_FIRST),
|
| - ASCIIToUTF16("Bart"));
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_FIRST),
|
| + ASCIIToUTF16("Lisa"));
|
| + UpdateProfile(1,
|
| + GetAllProfiles(1)[0]->guid(),
|
| + AutofillType(NAME_FIRST),
|
| + ASCIIToUTF16("Bart"));
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3663293.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableAutofill) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| ASSERT_TRUE(GetClient(0)->DisableSyncForDatatype(syncable::AUTOFILL));
|
| - AutofillHelper::AddProfile(
|
| - 0,
|
| - AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_FALSE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size());
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(1).size());
|
| + ASSERT_FALSE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllProfiles(0).size());
|
| + ASSERT_EQ(1U, GetAllProfiles(1).size());
|
|
|
| ASSERT_TRUE(GetClient(0)->EnableSyncForDatatype(syncable::AUTOFILL));
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3661291.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, DisableSync) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
|
| - AutofillHelper::AddProfile(
|
| - 0,
|
| - AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_FRASIER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_FRASIER));
|
| ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion("Added a profile."));
|
| - ASSERT_FALSE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size());
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(1).size());
|
| + ASSERT_FALSE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllProfiles(0).size());
|
| + ASSERT_EQ(1U, GetAllProfiles(1).size());
|
|
|
| ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
|
| ASSERT_TRUE(AwaitQuiescence());
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(2U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(2U, GetAllProfiles(0).size());
|
| }
|
|
|
| // TCM ID - 3608295.
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| string16 max_length_string(kMaxDataLength, '.');
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_FIRST),
|
| - max_length_string);
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_LAST),
|
| - max_length_string);
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(EMAIL_ADDRESS),
|
| - max_length_string);
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(ADDRESS_HOME_LINE1),
|
| - max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_FIRST),
|
| + max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_LAST),
|
| + max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(EMAIL_ADDRESS),
|
| + max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(ADDRESS_HOME_LINE1),
|
| + max_length_string);
|
|
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| }
|
|
|
| // TODO(braffert): Remove FAILS annotation when crbug.com/85769 is resolved.
|
| @@ -404,34 +380,29 @@ IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, MaxLength) {
|
| IN_PROC_BROWSER_TEST_F(TwoClientAutofillSyncTest, FAILS_ExceedsMaxLength) {
|
| ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
|
|
|
| - AutofillHelper::AddProfile(
|
| - 0, AutofillHelper::CreateAutofillProfile(AutofillHelper::PROFILE_HOMER));
|
| + AddProfile(0, CreateAutofillProfile(PROFILE_HOMER));
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_TRUE(AutofillHelper::ProfilesMatch(0, 1));
|
| - ASSERT_EQ(1U, AutofillHelper::GetAllProfiles(0).size());
|
| + ASSERT_TRUE(ProfilesMatch(0, 1));
|
| + ASSERT_EQ(1U, GetAllProfiles(0).size());
|
|
|
| string16 exceeds_max_length_string(kMaxDataLength + 1, '.');
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_FIRST),
|
| - exceeds_max_length_string);
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(NAME_LAST),
|
| - exceeds_max_length_string);
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(EMAIL_ADDRESS),
|
| - exceeds_max_length_string);
|
| - AutofillHelper::UpdateProfile(
|
| - 0,
|
| - AutofillHelper::GetAllProfiles(0)[0]->guid(),
|
| - AutofillType(ADDRESS_HOME_LINE1),
|
| - exceeds_max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_FIRST),
|
| + exceeds_max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(NAME_LAST),
|
| + exceeds_max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(EMAIL_ADDRESS),
|
| + exceeds_max_length_string);
|
| + UpdateProfile(0,
|
| + GetAllProfiles(0)[0]->guid(),
|
| + AutofillType(ADDRESS_HOME_LINE1),
|
| + exceeds_max_length_string);
|
|
|
| ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
|
| - ASSERT_FALSE(AutofillHelper::ProfilesMatch(0, 1));
|
| + ASSERT_FALSE(ProfilesMatch(0, 1));
|
| }
|
|
|