Commit b6c0615d authored by Jan Krcal's avatar Jan Krcal Committed by Commit Bot

[AF] Improve logging of basic autofill types

This CL simplifies debugging sync integration tests (and possibly other
tasks).

Bug: 853688
Change-Id: I4a72855cc400d33743cf8fc00979270af2ac92e0
Reviewed-on: https://chromium-review.googlesource.com/c/1406972Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Commit-Queue: Jan Krcal <jkrcal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#622073}
parent 0ef4a449
...@@ -13,4 +13,10 @@ bool AutofillMetadata::operator==(const AutofillMetadata& metadata) const { ...@@ -13,4 +13,10 @@ bool AutofillMetadata::operator==(const AutofillMetadata& metadata) const {
billing_address_id == metadata.billing_address_id; billing_address_id == metadata.billing_address_id;
} }
std::ostream& operator<<(std::ostream& os, const AutofillMetadata& metadata) {
return os << metadata.id << " " << metadata.use_count << " "
<< metadata.use_date << " " << metadata.has_converted << " "
<< metadata.billing_address_id;
}
} // namespace autofill } // namespace autofill
...@@ -39,6 +39,9 @@ struct AutofillMetadata { ...@@ -39,6 +39,9 @@ struct AutofillMetadata {
std::string billing_address_id; std::string billing_address_id;
}; };
// So we can compare AutofillMetadata with EXPECT_EQ().
std::ostream& operator<<(std::ostream& os, const AutofillMetadata& metadata);
} // namespace autofill } // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METADATA_H_ #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METADATA_H_
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/sha1.h" #include "base/sha1.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversion_utils.h" #include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -1112,7 +1113,11 @@ bool AutofillProfile::EqualsSansGuid(const AutofillProfile& profile) const { ...@@ -1112,7 +1113,11 @@ bool AutofillProfile::EqualsSansGuid(const AutofillProfile& profile) const {
} }
std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) { std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) {
return os << profile.guid() << " " << profile.origin() << " " return os << (profile.record_type() == AutofillProfile::LOCAL_PROFILE
? profile.guid()
: base::HexEncode(profile.server_id().data(),
profile.server_id().size()))
<< " " << profile.origin() << " "
<< UTF16ToUTF8(profile.GetRawInfo(NAME_FULL)) << " " << UTF16ToUTF8(profile.GetRawInfo(NAME_FULL)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(NAME_FIRST)) << " " << UTF16ToUTF8(profile.GetRawInfo(NAME_FIRST)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(NAME_MIDDLE)) << " " << UTF16ToUTF8(profile.GetRawInfo(NAME_MIDDLE)) << " "
......
...@@ -1029,7 +1029,11 @@ bool CreditCard::ShouldUpdateExpiration(const base::Time& current_time) const { ...@@ -1029,7 +1029,11 @@ bool CreditCard::ShouldUpdateExpiration(const base::Time& current_time) const {
// So we can compare CreditCards with EXPECT_EQ(). // So we can compare CreditCards with EXPECT_EQ().
std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) { std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) {
return os << base::UTF16ToUTF8(credit_card.Label()) << " " return os << base::UTF16ToUTF8(credit_card.Label()) << " "
<< credit_card.guid() << " " << credit_card.origin() << " " << (credit_card.record_type() == CreditCard::LOCAL_CARD
? credit_card.guid()
: base::HexEncode(credit_card.server_id().data(),
credit_card.server_id().size()))
<< " " << credit_card.origin() << " "
<< base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_NAME_FULL)) << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_NAME_FULL))
<< " " << " "
<< base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_TYPE)) << base::UTF16ToUTF8(credit_card.GetRawInfo(CREDIT_CARD_TYPE))
...@@ -1040,7 +1044,10 @@ std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) { ...@@ -1040,7 +1044,10 @@ std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) {
<< " " << " "
<< base::UTF16ToUTF8( << base::UTF16ToUTF8(
credit_card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)) credit_card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR))
<< " " << credit_card.use_count() << " " << credit_card.use_date(); << " " << credit_card.bank_name() << " "
<< " " << credit_card.record_type() << " "
<< credit_card.use_count() << " " << credit_card.use_date() << " "
<< credit_card.billing_address_id();
} }
void CreditCard::SetNameOnCardFromSeparateParts() { void CreditCard::SetNameOnCardFromSeparateParts() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment