| Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java
|
| index 7fbdcd87d26f3d46814eab72aa4acda46916ccad..e9cc6b311ab478f303789b48756b21d3b1d8f0db 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java
|
| @@ -48,6 +48,10 @@ public class PaymentRequestBillingAddressTest extends PaymentRequestTestBase {
|
| String profile3 = helper.setProfile(new AutofillProfile("", "https://example.com", true,
|
| "Tom Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "", "US",
|
| "310-310-6000", "jon.doe@gmail.com", "en-US"));
|
| + // This card has no billing address selected.
|
| + helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jane Doe",
|
| + "4242424242424242", "1111", "12", "2050", "visa", R.drawable.pr_visa,
|
| + "" /* billingAddressId */, "" /* serverId */));
|
|
|
| // Assign use stats so that profile2 has the highest frecency and profile3 has the lowest.
|
| helper.setProfileUseStatsForTesting(profile1, 5, 5);
|
| @@ -116,6 +120,63 @@ public class PaymentRequestBillingAddressTest extends PaymentRequestTestBase {
|
| }
|
|
|
| /**
|
| + * Tests that for a card that already has a billing address, adding a new one and cancelling
|
| + * maintains the previous selection. */
|
| + @MediumTest
|
| + @Feature({"Payments"})
|
| + public void testAddBillingAddressOnCardAndCancel_MaintainsPreviousSelection()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyToPay);
|
| + // Edit the only card.
|
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput);
|
| + clickInPaymentMethodAndWait(R.id.payments_open_editor_pencil_button, mReadyToEdit);
|
| +
|
| + // Jon Doe is selected as the billing address.
|
| + assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_INDEX)
|
| + .equals("Jon Doe, 340 Main St, Los Angeles, CA 90291"));
|
| +
|
| + // Select the "+ ADD ADDRESS" option for the billing address.
|
| + setSpinnerSelectionsInCardEditorAndWait(
|
| + new int[] {DECEMBER, NEXT_YEAR, ADD_BILLING_ADDRESS}, mReadyToEdit);
|
| +
|
| + // Cancel the creation of a new billing address.
|
| + clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToEdit);
|
| +
|
| + // Jon Doe is STILL selected as the billing address.
|
| + assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_INDEX)
|
| + .equals("Jon Doe, 340 Main St, Los Angeles, CA 90291"));
|
| + }
|
| +
|
| + /**
|
| + * Tests that adding a billing address for a card that has none, and cancelling then returns
|
| + * to the proper selection (Select...).
|
| + */
|
| + @MediumTest
|
| + @Feature({"Payments"})
|
| + public void testAddBillingAddressOnCardWithNoBillingAndCancel_MaintainsPreviousSelection()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyToPay);
|
| + // Edit the second card.
|
| + clickInPaymentMethodAndWait(R.id.payments_section, mReadyForInput);
|
| + clickOnPaymentMethodSuggestionOptionAndWait(1, mReadyForInput);
|
| +
|
| + // Now in Card Editor to add a billing address. "Select" is selected in the dropdown.
|
| + assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_INDEX)
|
| + .equals("Select"));
|
| +
|
| + // Select the "+ ADD ADDRESS" option for the billing address.
|
| + setSpinnerSelectionsInCardEditorAndWait(
|
| + new int[] {DECEMBER, NEXT_YEAR, ADD_BILLING_ADDRESS}, mReadyToEdit);
|
| +
|
| + // Cancel the creation of a new billing address.
|
| + clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToEdit);
|
| +
|
| + // "Select" is STILL selected as the billing address.
|
| + assertTrue(getSpinnerSelectionTextInCardEditor(BILLING_ADDRESS_DROPDOWN_INDEX)
|
| + .equals("Select"));
|
| + }
|
| +
|
| + /**
|
| * Verifies that the billing address suggestions are ordered by frecency.
|
| */
|
| @MediumTest
|
|
|