summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_profile.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-24 08:32:55 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-24 08:32:55 +0000
commit2609bc107a31083c6c88e207d13eaa029d594235 (patch)
tree8331e468eb82a2a9611f388349da4f3565ee3201 /chrome/browser/autofill/autofill_profile.cc
parent51552aae65a96d19e1adcbf6fe760f102b53a8bf (diff)
downloadchromium_src-2609bc107a31083c6c88e207d13eaa029d594235.zip
chromium_src-2609bc107a31083c6c88e207d13eaa029d594235.tar.gz
chromium_src-2609bc107a31083c6c88e207d13eaa029d594235.tar.bz2
Add the ability to save and remove AutoFill profiles from the AutoFillDialog.
BUG=18201 TEST=PersonalDataManagerTest.SetProfiles Review URL: http://codereview.chromium.org/545175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36978 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/autofill_profile.cc')
-rw-r--r--chrome/browser/autofill/autofill_profile.cc39
1 files changed, 38 insertions, 1 deletions
diff --git a/chrome/browser/autofill/autofill_profile.cc b/chrome/browser/autofill/autofill_profile.cc
index a292a41..bfc4fef 100644
--- a/chrome/browser/autofill/autofill_profile.cc
+++ b/chrome/browser/autofill/autofill_profile.cc
@@ -144,8 +144,9 @@ bool AutoFillProfile::operator==(const AutoFillProfile& profile) const {
if (label_ != profile.label_ ||
unique_id_ != profile.unique_id_ ||
- use_billing_address_ != profile.use_billing_address_)
+ use_billing_address_ != profile.use_billing_address_) {
return false;
+ }
for (size_t index = 0; index < arraysize(types); ++index) {
if (GetFieldText(AutoFillType(types[index])) !=
@@ -183,3 +184,39 @@ Address* AutoFillProfile::GetBillingAddress() {
Address* AutoFillProfile::GetHomeAddress() {
return static_cast<Address*>(personal_info_[AutoFillType::ADDRESS_HOME]);
}
+
+// So we can compare AutoFillProfiles with EXPECT_EQ().
+std::ostream& operator<<(std::ostream& os, const AutoFillProfile& profile) {
+ return os
+ << UTF16ToASCII(profile.Label())
+ << " "
+ << profile.unique_id()
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_MIDDLE)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(EMAIL_ADDRESS)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(COMPANY_NAME)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_CITY)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_STATE)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(
+ PHONE_HOME_WHOLE_NUMBER)))
+ << " "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(
+ PHONE_FAX_WHOLE_NUMBER)));
+}