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

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: Use the credit card number field in metrics tests, because ios single-field form fill will not requ… 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..75a7a7afb6c7e142653c7ef4beb1226546d5230c 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -933,6 +933,12 @@ class AutofillManagerTest : public testing::Test {
#endif // defined(OS_IOS)
}
+ // Convenience method to cast the FullCardRequest into a CardUnmaskDelegate.
+ CardUnmaskDelegate* full_card_unmask_delegate() {
+ DCHECK(autofill_manager_->full_card_request_);
+ return (CardUnmaskDelegate*)autofill_manager_->full_card_request_.get();
+ }
+
protected:
base::MessageLoop message_loop_;
MockAutofillClient autofill_client_;
@@ -4148,10 +4154,10 @@ TEST_F(AutofillManagerTest, DontOfferToSavePaymentsCard) {
form.fields[i].value = ASCIIToUTF16("2017");
}
- AutofillManager::UnmaskResponse response;
+ CardUnmaskDelegate::UnmaskResponse response;
response.should_store_pan = false;
response.cvc = ASCIIToUTF16("123");
- autofill_manager_->OnUnmaskResponse(response);
+ full_card_unmask_delegate()->OnUnmaskResponse(response);
autofill_manager_->OnDidGetRealPan(AutofillClient::SUCCESS,
"4012888888881881");
autofill_manager_->OnFormSubmitted(form);
@@ -4162,21 +4168,14 @@ 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);
+ full_card_unmask_delegate()->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));
}
TEST_F(AutofillManagerTest, UploadCreditCard) {
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698