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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java

Issue 2451303002: [Payments] Don't add expired cards in Payment Request. (Closed)
Patch Set: Addressed comments Created 4 years, 2 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/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java
index e07f7846bcd06a13cc7124c61050a8599adc18b6..1d06485d51e4f13c9f1b0b2b029ae9ff6b225dcb 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestExpiredLocalCardTest.java
@@ -13,6 +13,7 @@ import org.chromium.chrome.browser.autofill.AutofillTestHelper;
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
+import java.util.Calendar;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
@@ -81,4 +82,34 @@ public class PaymentRequestExpiredLocalCardTest extends PaymentRequestTestBase {
assertEquals("11", storedCard.getMonth());
assertEquals("2026", storedCard.getYear());
}
+
+ /**
+ * Tests that it is not possible to add an expired card in a payment request.
+ */
+ @MediumTest
+ @Feature({"Payments"})
+ public void testCannotAddExpiredCard()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ // If the current date is in January skip this test. It is not possible to select an expired
+ // data in the card editor in January.
+ Calendar now = Calendar.getInstance();
+ if (now.get(Calendar.MONTH) == 0) return;
+
+ triggerUIAndWait(mReadyToPay);
+
+ // Try to add an expired card.
+ clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput);
+ clickInPaymentMethodAndWait(R.id.payments_add_option_button, mReadyToEdit);
+ // Set the expiration date to past month of the current year.
+ setSpinnerSelectionsInCardEditorAndWait(
+ new int[] {now.get(Calendar.MONTH) - 1, 0, 1}, mBillingAddressChangeProcessed);
+ setTextInCardEditorAndWait(new String[] {"4111111111111111", "Jon Doe"}, mEditorTextUpdate);
+ clickInCardEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError);
+
+ // Set the expiration date to the current month of the current year.
+ setSpinnerSelectionsInCardEditorAndWait(new int[] {now.get(Calendar.MONTH), 0, 1},
+ mExpirationMonthChange);
+
+ clickInCardEditorAndWait(R.id.payments_edit_done_button, mReadyToPay);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698