summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 01:09:02 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-22 01:09:02 +0000
commit22aab1de7d733fed649605db7cc33ddf255332cf (patch)
tree2d40fcda46a277a02d6629143392246c9c9fd225
parent4e91b5cd8d0aac47c5bc0bc5343103e4243b812a (diff)
downloadchromium_src-22aab1de7d733fed649605db7cc33ddf255332cf.zip
chromium_src-22aab1de7d733fed649605db7cc33ddf255332cf.tar.gz
chromium_src-22aab1de7d733fed649605db7cc33ddf255332cf.tar.bz2
AutoFill schema changes break AutoFill syncing
AutoFill sync relies on the presence of a valid profile label. This change sets all profile labels prior to saving to the database. BUG=56305 TEST=PersonalDataManager.*, manual test of creating a new profile, then checking the "Web Data" sqlite database to see that the profile label was set correctly. Review URL: http://codereview.chromium.org/3471004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60139 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autofill/personal_data_manager.cc14
-rw-r--r--chrome/browser/autofill/personal_data_manager_unittest.cc27
-rw-r--r--chrome/test/live_sync/live_autofill_sync_test.h2
-rw-r--r--chrome/test/live_sync/live_sync_test.cc6
-rw-r--r--chrome/test/live_sync/two_client_live_autofill_sync_test.cc57
5 files changed, 88 insertions, 18 deletions
diff --git a/chrome/browser/autofill/personal_data_manager.cc b/chrome/browser/autofill/personal_data_manager.cc
index 4e358a7..8fc91c2 100644
--- a/chrome/browser/autofill/personal_data_manager.cc
+++ b/chrome/browser/autofill/personal_data_manager.cc
@@ -50,6 +50,11 @@ class DereferenceFunctor {
}
};
+template<typename T>
+T* address_of(T& v) {
+ return &v;
+}
+
} // namespace
PersonalDataManager::~PersonalDataManager() {
@@ -285,6 +290,15 @@ void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) {
}
}
+ // Ensure that profile labels are up to date. Currently, sync relies on
+ // labels to identify a profile.
+ // TODO(dhollowa): We need to deprecate labels and update the way sync
+ // identifies profiles.
+ std::vector<AutoFillProfile*> profile_pointers(profiles->size());
+ std::transform(profiles->begin(), profiles->end(), profile_pointers.begin(),
+ address_of<AutoFillProfile>);
+ AutoFillProfile::AdjustInferredLabels(&profile_pointers);
+
// Add the new profiles to the web database.
for (std::vector<AutoFillProfile>::iterator iter = profiles->begin();
iter != profiles->end(); ++iter) {
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index 18741a2..1709421 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -133,8 +133,11 @@ TEST_F(PersonalDataManagerTest, SetProfiles) {
// The PersonalDataManager will update the unique IDs when saving the
// profiles, so we have to update the expectations.
+ // Same for labels.
profile0.set_unique_id(update[0].unique_id());
profile1.set_unique_id(update[1].unique_id());
+ profile0.set_label(update[0].Label());
+ profile1.set_label(update[1].Label());
const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles();
ASSERT_EQ(2U, results1.size());
@@ -152,7 +155,10 @@ TEST_F(PersonalDataManagerTest, SetProfiles) {
personal_data_->SetProfiles(&update);
// Set the expected unique ID for profile2.
+ // Same for labels.
+ profile0.set_label(update[0].Label());
profile2.set_unique_id(update[1].unique_id());
+ profile2.set_label(update[1].Label());
// AutoFillProfile IDs are re-used, so the third profile to be added will have
// a unique ID that matches the old unique ID of the removed profile1, even
@@ -179,7 +185,9 @@ TEST_F(PersonalDataManagerTest, SetProfiles) {
// Verify that we've loaded the profiles from the web database.
const std::vector<AutoFillProfile*>& results3 = personal_data_->profiles();
ASSERT_EQ(2U, results3.size());
+ profile0.set_label(results3.at(0)->Label());
EXPECT_EQ(profile0, *results3.at(0));
+ profile2.set_label(results3.at(1)->Label());
EXPECT_EQ(profile2, *results3.at(1));
}
@@ -213,8 +221,11 @@ TEST_F(PersonalDataManagerTest, SetCreditCards) {
// The PersonalDataManager will update the unique IDs when saving the
// credit cards, so we have to update the expectations.
+ // Same for labels.
creditcard0.set_unique_id(update[0].unique_id());
creditcard1.set_unique_id(update[1].unique_id());
+ creditcard0.set_label(update[0].Label());
+ creditcard1.set_label(update[1].Label());
const std::vector<CreditCard*>& results1 = personal_data_->credit_cards();
ASSERT_EQ(2U, results1.size());
@@ -232,7 +243,9 @@ TEST_F(PersonalDataManagerTest, SetCreditCards) {
personal_data_->SetCreditCards(&update);
// Set the expected unique ID for creditcard2.
+ // Same for labels.
creditcard2.set_unique_id(update[1].unique_id());
+ creditcard2.set_label(update[1].Label());
// CreditCard IDs are re-used, so the third credit card to be added will have
// a unique ID that matches the old unique ID of the removed creditcard1, even
@@ -301,8 +314,11 @@ TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) {
// The PersonalDataManager will update the unique IDs when saving the
// profiles, so we have to update the expectations.
+ // Same for labels.
profile0.set_unique_id(update[0].unique_id());
profile1.set_unique_id(update[1].unique_id());
+ profile0.set_label(update[0].Label());
+ profile1.set_label(update[1].Label());
const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles();
ASSERT_EQ(2U, results1.size());
@@ -317,8 +333,11 @@ TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) {
// The PersonalDataManager will update the unique IDs when saving the
// credit cards, so we have to update the expectations.
+ // Same for labels.
creditcard0.set_unique_id(update_cc[0].unique_id());
creditcard1.set_unique_id(update_cc[1].unique_id());
+ creditcard0.set_label(update_cc[0].Label());
+ creditcard1.set_label(update_cc[1].Label());
const std::vector<CreditCard*>& results2 = personal_data_->credit_cards();
ASSERT_EQ(2U, results2.size());
@@ -490,6 +509,8 @@ TEST_F(PersonalDataManagerTest, Refresh) {
profile0.set_unique_id(update[0].unique_id());
profile1.set_unique_id(update[1].unique_id());
+ profile0.set_label(update[0].Label());
+ profile1.set_label(update[1].Label());
// Wait for the refresh.
EXPECT_CALL(personal_data_observer_,
@@ -581,6 +602,7 @@ TEST_F(PersonalDataManagerTest, ImportFormData) {
NULL, NULL, NULL);
const std::vector<AutoFillProfile*>& results = personal_data_->profiles();
ASSERT_EQ(1U, results.size());
+ expected.set_label(results[0]->Label());
EXPECT_EQ(expected, *results[0]);
}
@@ -659,6 +681,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) {
NULL, NULL, NULL);
const std::vector<AutoFillProfile*>& results = personal_data_->profiles();
ASSERT_EQ(1U, results.size());
+ expected->set_label(results[0]->Label());
EXPECT_EQ(*expected, *results[0]);
// Now create a completely different profile.
@@ -691,12 +714,14 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) {
autofill_unittest::SetProfileInfo(expected.get(), NULL, "George", NULL,
"Washington", "theprez@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL);
+ expected->set_label(results2[0]->Label());
EXPECT_EQ(*expected, *results2[0]);
expected.reset(new AutoFillProfile(string16(), 2));
autofill_unittest::SetProfileInfo(expected.get(), NULL, "John", NULL,
"Adams", "second@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
+ expected->set_label(results2[1]->Label());
EXPECT_EQ(*expected, *results2[1]);
// Submit a form with new data for the first profile.
@@ -738,11 +763,13 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) {
autofill_unittest::SetProfileInfo(expected.get(), NULL, "George", NULL,
"Washington", "theprez@gmail.com", NULL, "190 High Street", NULL,
"Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL);
+ expected->set_label(results3[0]->Label());
EXPECT_EQ(*expected, *results3[0]);
expected.reset(new AutoFillProfile(string16(), 2));
autofill_unittest::SetProfileInfo(expected.get(), NULL, "John", NULL,
"Adams", "second@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL);
+ expected->set_label(results3[1]->Label());
EXPECT_EQ(*expected, *results3[1]);
}
diff --git a/chrome/test/live_sync/live_autofill_sync_test.h b/chrome/test/live_sync/live_autofill_sync_test.h
index 7e1d76d..279641e 100644
--- a/chrome/test/live_sync/live_autofill_sync_test.h
+++ b/chrome/test/live_sync/live_autofill_sync_test.h
@@ -256,7 +256,7 @@ class LiveAutofillSyncTest : public LiveSyncTest {
pdm->Refresh();
MessageLoop::current()->Run();
pdm->RemoveObserver(&observer);
- return pdm->profiles();
+ return pdm->web_profiles();
}
bool CompareAutoFillProfiles(const AutoFillProfiles& expected_profiles,
diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc
index 14ecf8d..01c5361 100644
--- a/chrome/test/live_sync/live_sync_test.cc
+++ b/chrome/test/live_sync/live_sync_test.cc
@@ -13,6 +13,7 @@
#include "base/task.h"
#include "base/waitable_event.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/password_manager/encryptor.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
@@ -143,6 +144,11 @@ void LiveSyncTest::SetUp() {
if (!cl->HasSwitch(switches::kSyncServiceURL))
SetUpLocalTestServer();
+ // Mock the Mac Keychain service. The real Keychain can block on user input.
+#if defined(OS_MACOSX)
+ Encryptor::UseMockKeychain(true);
+#endif
+
// Yield control back to the InProcessBrowserTest framework.
InProcessBrowserTest::SetUp();
}
diff --git a/chrome/test/live_sync/two_client_live_autofill_sync_test.cc b/chrome/test/live_sync/two_client_live_autofill_sync_test.cc
index 722c1fd..edda6a4 100644
--- a/chrome/test/live_sync/two_client_live_autofill_sync_test.cc
+++ b/chrome/test/live_sync/two_client_live_autofill_sync_test.cc
@@ -155,6 +155,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ProfileClient1HasData) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients()));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -172,8 +173,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ConflictLabels) {
AutoFillProfiles profiles2;
profiles2.push_back(new AutoFillProfile(string16(), 0));
- FillProfile(PROFILE_MARION, profiles2[0]);
- profiles2[0]->set_label(ASCIIToUTF16("Shipping"));
+ FillProfile(PROFILE_HOMER, profiles2[0]);
+ profiles2[0]->SetInfo(AutoFillType(PHONE_FAX_WHOLE_NUMBER),
+ ASCIIToUTF16("1234567890"));
AddProfile(GetPersonalDataManager(0), *profiles1[0]);
AddProfile(GetPersonalDataManager(1), *profiles2[0]);
@@ -181,8 +183,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ConflictLabels) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients()));
- // Since client1 associates first, client2's "Shipping" profile will
+ // Since client1 associates first, client2's profile will
// be overwritten by the one stored in the cloud by profile1.
+ AutoFillProfile::AdjustInferredLabels(&profiles1);
EXPECT_TRUE(CompareAutoFillProfiles(profiles1,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(profiles1,
@@ -208,8 +211,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest,
ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients()));
// One of the duplicate profiles will have its label renamed to
- // "Shipping2".
- expected_profiles[0]->set_label(ASCIIToUTF16("Shipping2"));
+ // the first label with "2" appended.
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
+ expected_profiles[0]->set_label(expected_profiles[1]->Label() +
+ ASCIIToUTF16("2"));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
@@ -228,6 +233,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ProfileSteady) {
AddProfile(GetPersonalDataManager(0), *expected_profiles[0]);
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -239,6 +245,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ProfileSteady) {
AddProfile(GetPersonalDataManager(1), *expected_profiles[1]);
EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -251,16 +258,19 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ProfileSteady) {
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
// The conflicting profile's label will be made unique.
- expected_profiles[2]->set_label(ASCIIToUTF16("Billing2"));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
+ expected_profiles[2]->set_label(expected_profiles[1]->Label() +
+ ASCIIToUTF16("2"));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(1))));
// Client1 removes a profile.
+ string16 label0 = expected_profiles[0]->Label();
delete expected_profiles.front();
expected_profiles.erase(expected_profiles.begin());
- RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Shipping"));
+ RemoveProfile(GetPersonalDataManager(1), label0);
EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -272,7 +282,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ProfileSteady) {
expected_profiles[0]->SetInfo(AutoFillType(NAME_FIRST),
ASCIIToUTF16("Bart"));
UpdateProfile(GetPersonalDataManager(0),
- ASCIIToUTF16("Billing"),
+ expected_profiles[0]->Label(),
AutoFillType(NAME_FIRST),
ASCIIToUTF16("Bart"));
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
@@ -283,9 +293,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ProfileSteady) {
GetAllAutoFillProfiles(GetPersonalDataManager(1))));
// Client1 removes everything.
+ string16 label1 = expected_profiles[0]->Label();
+ string16 label2 = expected_profiles[1]->Label();
STLDeleteElements(&expected_profiles);
- RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing"));
- RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing2"));
+ RemoveProfile(GetPersonalDataManager(1), label1);
+ RemoveProfile(GetPersonalDataManager(1), label2);
EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -304,6 +316,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, AddEmptyProfile) {
AddProfile(GetPersonalDataManager(0), *expected_profiles[0]);
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -321,6 +334,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, AddProfile) {
AddProfile(GetPersonalDataManager(0), *expected_profiles[0]);
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -385,14 +399,16 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, DeleteProfile) {
AddProfile(GetPersonalDataManager(0), *expected_profiles[0]);
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(1))));
+ string16 label = expected_profiles.front()->Label();
delete expected_profiles.front();
expected_profiles.erase(expected_profiles.begin());
- RemoveProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing"));
+ RemoveProfile(GetPersonalDataManager(1), label);
EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -423,6 +439,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, MergeProfiles) {
AddProfile(GetPersonalDataManager(1), *expected_profiles[3]);
EXPECT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -440,6 +457,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, UpdateFields) {
AddProfile(GetPersonalDataManager(0), *expected_profiles[0]);
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
@@ -448,9 +466,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, UpdateFields) {
expected_profiles[0]->SetInfo(AutoFillType(NAME_FIRST), ASCIIToUTF16("Lisa"));
expected_profiles[0]->SetInfo(
AutoFillType(EMAIL_ADDRESS), ASCIIToUTF16("grrrl@TV.com"));
- UpdateProfile(GetPersonalDataManager(0), ASCIIToUTF16("Billing"),
+ UpdateProfile(GetPersonalDataManager(0), expected_profiles[0]->Label(),
AutoFillType(NAME_FIRST), ASCIIToUTF16("Lisa"));
- UpdateProfile(GetPersonalDataManager(0), ASCIIToUTF16("Billing"),
+ UpdateProfile(GetPersonalDataManager(0), expected_profiles[0]->Label(),
AutoFillType(EMAIL_ADDRESS), ASCIIToUTF16("grrrl@TV.com"));
ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients()));
@@ -464,23 +482,27 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, UpdateFields) {
IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, UpdateLabel) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+ AutoFillProfiles expected_profiles;
AutoFillProfiles profiles0;
profiles0.push_back(new AutoFillProfile(string16(), 0));
FillProfile(PROFILE_HOMER, profiles0[0]);
+ expected_profiles.push_back(profiles0[0]);
AutoFillProfiles profiles1;
profiles1.push_back(new AutoFillProfile(string16(), 0));
FillProfile(PROFILE_MARION, profiles1[0]);
profiles1[0]->set_label(ASCIIToUTF16("Shipping"));
+ expected_profiles.push_back(profiles1[0]);
AddProfile(GetPersonalDataManager(0), *profiles0[0]);
AddProfile(GetPersonalDataManager(1), *profiles1[0]);
ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients()));
- EXPECT_TRUE(CompareAutoFillProfiles(profiles0,
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
+ EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
- EXPECT_TRUE(CompareAutoFillProfiles(profiles0,
+ EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(1))));
STLDeleteElements(&profiles0);
STLDeleteElements(&profiles1);
@@ -496,14 +518,15 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveAutofillSyncTest, ConflictFields) {
AddProfile(GetPersonalDataManager(0), *expected_profiles[0]);
EXPECT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
+ AutoFillProfile::AdjustInferredLabels(&expected_profiles);
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(0))));
EXPECT_TRUE(CompareAutoFillProfiles(expected_profiles,
GetAllAutoFillProfiles(GetPersonalDataManager(1))));
- UpdateProfile(GetPersonalDataManager(0), ASCIIToUTF16("Billing"),
+ UpdateProfile(GetPersonalDataManager(0), expected_profiles[0]->Label(),
AutoFillType(NAME_FIRST), ASCIIToUTF16("Lisa"));
- UpdateProfile(GetPersonalDataManager(1), ASCIIToUTF16("Billing"),
+ UpdateProfile(GetPersonalDataManager(1), expected_profiles[0]->Label(),
AutoFillType(NAME_FIRST), ASCIIToUTF16("Bart"));
ASSERT_TRUE(ProfileSyncServiceTestHarness::AwaitQuiescence(clients()));