Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java |
index 5f199ec99691983cbec0a14182601687f7bc8547..f6635cf0a7536d8cb65edeb654daf8da185ae8b7 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java |
@@ -83,6 +83,15 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeT |
/** The billing address dropdown index for the first billing address. */ |
protected static final int FIRST_BILLING_ADDRESS = 0; |
+ /** The dropdown index for the California. */ |
+ protected static final int CA = 8; |
+ |
+ /** The dropdown index for the New York. */ |
+ protected static final int NY = 42; |
+ |
+ /** The dropdown index for the United States. */ |
+ protected static final int US = 236; |
+ |
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput; |
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay; |
protected final PaymentsCallbackHelper<PaymentRequestUI> mSelectionChecked; |
@@ -563,6 +572,22 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeT |
helper.waitForCallback(callCount); |
} |
+ /** Selects the spinner value in the editor for Payment Request form and wait. */ |
+ protected void setSpinnerSelectionsInEditorAndWait(final int[] selections, |
+ CallbackHelper helper) throws InterruptedException, TimeoutException { |
+ int callCount = helper.getCallCount(); |
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
+ @Override |
+ public void run() { |
+ List<Spinner> fields = mUI.getEditorView().getDropdownFieldsForTest(); |
+ for (int i = 0; i < selections.length && i < fields.size(); i++) { |
+ fields.get(i).setSelection(selections[i]); |
+ } |
+ } |
+ }); |
+ helper.waitForCallback(callCount); |
+ } |
+ |
/** Directly sets the text in the editor UI for credit cards. */ |
protected void setTextInCardEditorAndWait(final String[] values, CallbackHelper helper) |
throws InterruptedException, TimeoutException { |