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

Unified Diff: chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc

Issue 2713873002: [Payments] Add validation for unsupported credit card types in editor. (Closed)
Patch Set: addressed comments Created 3 years, 10 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: chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc b/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
index d41a30e5c13e8f98ea427bf2420817e9620c189f..e408da89f596c9b99461eb5bee005ca61fc25579 100644
--- a/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
+++ b/chrome/browser/ui/views/payments/payment_request_credit_card_editor_interactive_uitest.cc
@@ -202,6 +202,42 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
}
IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
+ EnteringUnsupportedCardType) {
+ autofill::TestAutofillClock test_clock;
+ test_clock.SetNow(kJune2017);
+
+ InvokePaymentRequestUI();
+
+ OpenPaymentMethodScreen();
+
+ OpenCreditCardEditorScreen();
+
+ SetEditorTextfieldValue(base::ASCIIToUTF16("Bob Jones"),
+ autofill::CREDIT_CARD_NAME_FULL);
+ // In this test case, only "visa" and "mastercard" are supported, so entering
+ // a MIR card will fail.
+ SetEditorTextfieldValue(base::ASCIIToUTF16("22222222invalidcard"),
+ autofill::CREDIT_CARD_NUMBER);
+ EXPECT_EQ(l10n_util::GetStringUTF16(
+ IDS_PAYMENTS_VALIDATION_UNSUPPORTED_CREDIT_CARD_TYPE),
+ GetErrorLabelForType(autofill::CREDIT_CARD_NUMBER));
+ SetComboboxValue(base::ASCIIToUTF16("05"), autofill::CREDIT_CARD_EXP_MONTH);
+ SetComboboxValue(base::ASCIIToUTF16("2026"),
+ autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR);
+
+ ClickOnDialogViewAndWait(DialogViewID::EDITOR_SAVE_BUTTON);
+
+ EXPECT_FALSE(IsEditorTextfieldInvalid(autofill::CREDIT_CARD_NAME_FULL));
+ EXPECT_TRUE(IsEditorTextfieldInvalid(autofill::CREDIT_CARD_NUMBER));
+ EXPECT_FALSE(IsEditorComboboxInvalid(autofill::CREDIT_CARD_EXP_MONTH));
+ EXPECT_FALSE(IsEditorComboboxInvalid(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR));
+
+ autofill::PersonalDataManager* personal_data_manager =
+ GetPaymentRequests(GetActiveWebContents())[0]->personal_data_manager();
+ EXPECT_EQ(0u, personal_data_manager->GetCreditCards().size());
+}
+
+IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest,
EnteringInvalidCardNumber_AndFixingIt) {
autofill::TestAutofillClock test_clock;
test_clock.SetNow(kJune2017);
« no previous file with comments | « chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc ('k') | components/autofill/core/browser/validation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698