Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 1899893002: Card unmasking without form filling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar tests Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index 227578f4ad74439ad191f313f9fe50b84dbae63c..be43ab5f127b09597deae59d5830d593f4ecf847 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -4148,12 +4148,19 @@ TEST_F(AutofillManagerTest, DontOfferToSavePaymentsCard) {
form.fields[i].value = ASCIIToUTF16("2017");
}
- AutofillManager::UnmaskResponse response;
+ autofill_manager_->full_card_request()->GetFullCard(
+ card, AutofillClient::UNMASK_FOR_AUTOFILL,
+ autofill_manager_->weak_ptr_factory_.GetWeakPtr());
+
+ CardUnmaskDelegate::UnmaskResponse response;
response.should_store_pan = false;
response.cvc = ASCIIToUTF16("123");
- autofill_manager_->OnUnmaskResponse(response);
- autofill_manager_->OnDidGetRealPan(AutofillClient::SUCCESS,
- "4012888888881881");
+ ((CardUnmaskDelegate*)autofill_manager_->full_card_request())
+ ->OnUnmaskResponse(response);
+
+ ((payments::PaymentsClientDelegate*)autofill_manager_->full_card_request())
+ ->OnDidGetRealPan(AutofillClient::SUCCESS, "4012888888881881");
+
autofill_manager_->OnFormSubmitted(form);
}
@@ -4162,21 +4169,16 @@ TEST_F(AutofillManagerTest, FillInUpdatedExpirationDate) {
CreditCard card;
PrepareForRealPanResponse(&form, &card);
- AutofillManager::UnmaskResponse response;
+ CardUnmaskDelegate::UnmaskResponse response;
response.should_store_pan = false;
response.cvc = ASCIIToUTF16("123");
response.exp_month = ASCIIToUTF16("02");
response.exp_year = ASCIIToUTF16("2018");
- autofill_manager_->OnUnmaskResponse(response);
- autofill_manager_->OnDidGetRealPan(AutofillClient::SUCCESS,
- "4012888888881881");
-
- EXPECT_EQ(ASCIIToUTF16("02"),
- autofill_manager_->unmask_request_.card.GetRawInfo(
- CREDIT_CARD_EXP_MONTH));
- EXPECT_EQ(ASCIIToUTF16("2018"),
- autofill_manager_->unmask_request_.card.GetRawInfo(
- CREDIT_CARD_EXP_4_DIGIT_YEAR));
+ ((CardUnmaskDelegate*)autofill_manager_->full_card_request())
+ ->OnUnmaskResponse(response);
+
+ ((payments::PaymentsClientDelegate*)autofill_manager_->full_card_request())
+ ->OnDidGetRealPan(AutofillClient::SUCCESS, "4012888888881881");
}
TEST_F(AutofillManagerTest, UploadCreditCard) {

Powered by Google App Engine
This is Rietveld 408576698