Commit 7ba7ed5e authored by Siyu An's avatar Siyu An Committed by Commit Bot

[Autofill Offer] Update offer text to "cashback"

Bug: 1112095
Change-Id: I614ec70d4ba183850cd19412c963bd344b7c318c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444800
Commit-Queue: Siyu An <siyua@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#813422}
parent c2aef3a0
...@@ -62,14 +62,9 @@ void AutofillOfferManager::UpdateSuggestionsWithOffers( ...@@ -62,14 +62,9 @@ void AutofillOfferManager::UpdateSuggestionsWithOffers(
for (auto& suggestion : suggestions) { for (auto& suggestion : suggestions) {
std::string id = suggestion.backend_id; std::string id = suggestion.backend_id;
if (eligible_offers_map.count(id)) { if (eligible_offers_map.count(id)) {
base::string16 reward_amount = suggestion.offer_label = l10n_util::GetStringFUTF16(
base::UTF8ToUTF16(eligible_offers_map[id]->offer_reward_amount); IDS_AUTOFILL_OFFERS_CASHBACK,
base::UTF8ToUTF16(eligible_offers_map[id]->offer_reward_amount));
auto string_id = (reward_amount.find('%') == std::string::npos)
? IDS_AUTOFILL_OFFERS_DISCOUNT
: IDS_AUTOFILL_OFFERS_CASHBACK;
suggestion.offer_label =
l10n_util::GetStringFUTF16(string_id, reward_amount);
} }
} }
} }
......
...@@ -96,7 +96,7 @@ TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleDiscount) { ...@@ -96,7 +96,7 @@ TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleDiscount) {
autofill_offer_manager_->UpdateSuggestionsWithOffers(GURL(kTestUrlWithParam), autofill_offer_manager_->UpdateSuggestionsWithOffers(GURL(kTestUrlWithParam),
suggestions); suggestions);
EXPECT_EQ(suggestions[0].offer_label, base::UTF8ToUTF16("$4 Off")); EXPECT_EQ(suggestions[0].offer_label, base::UTF8ToUTF16("$4 cashback"));
} }
TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleCashback) { TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleCashback) {
...@@ -108,7 +108,7 @@ TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleCashback) { ...@@ -108,7 +108,7 @@ TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_EligibleCashback) {
autofill_offer_manager_->UpdateSuggestionsWithOffers(GURL(kTestUrlWithParam), autofill_offer_manager_->UpdateSuggestionsWithOffers(GURL(kTestUrlWithParam),
suggestions); suggestions);
EXPECT_EQ(suggestions[0].offer_label, base::UTF8ToUTF16("5% Cash Back")); EXPECT_EQ(suggestions[0].offer_label, base::UTF8ToUTF16("5% cashback"));
} }
TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_ExpiredOffer) { TEST_F(AutofillOfferManagerTest, UpdateSuggestionsWithOffers_ExpiredOffer) {
......
...@@ -507,10 +507,6 @@ ...@@ -507,10 +507,6 @@
<!-- Credit card offers and rewards related strings --> <!-- Credit card offers and rewards related strings -->
<message name="IDS_AUTOFILL_OFFERS_CASHBACK" desc="Displays that a cashback offer will be rewarded if credit card is used on current page. Part of Autofill suggestions popup."> <message name="IDS_AUTOFILL_OFFERS_CASHBACK" desc="Displays that a cashback offer will be rewarded if credit card is used on current page. Part of Autofill suggestions popup.">
<ph name="PERCENT">$1<ex>5%</ex></ph> Cash Back <ph name="REWARD_VALUE">$1<ex>5%</ex></ph> cashback
</message> </message>
<message name="IDS_AUTOFILL_OFFERS_DISCOUNT" desc="Displays a discount that will be rewarded if credit card is used on current page. Part of Autofill suggestions popup.">
<ph name="DISCOUNT">$1<ex>$$3</ex></ph> Off
</message>
</grit-part> </grit-part>
378244426ac8f525d17518614e3d7b1508061cf9 c4d8bc532aa3a5146c9d639d56c364ddb1a3db14
\ No newline at end of file \ No newline at end of file
a09ae4c895b292cf8ce625cf9843a477d86dfc35
\ No newline at end of file
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