Chromium Code Reviews| 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 a117f225ee5949f187331eee87f027620e040b90..e369bb04a8f02bfe77cff247fa9904c89ab7a396 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 |
| @@ -60,6 +60,15 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA |
| private PaymentRequestUI mUI; |
| private CardUnmaskPrompt mCardUnmaskPrompt; |
| + /** An array mapping the index of a option label to its id. */ |
|
please use gerrit instead
2016/07/08 09:36:26
"an option label"
sebsg
2016/07/08 09:50:42
Done.
|
| + private final int[] mOptionLabelIds = { |
| + R.id.payments_first_option_label, |
| + R.id.payments_second_option_label, |
| + R.id.payments_third_option_label, |
| + R.id.payments_fourth_option_label, |
| + R.id.payments_fifth_option_label |
| + }; |
| + |
| protected PaymentRequestTestBase(String testFileName) { |
| super(ChromeActivity.class); |
| mReadyForInput = new PaymentsCallbackHelper<>(); |
| @@ -206,6 +215,40 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA |
| }); |
| } |
| + /** |
| + * Returns the label corresponding to the contact detail suggestion at the specified |
| + * |suggestionIndex|. Returns null if there is no suggestion at |suggestionIndex|. |
| + */ |
| + protected String getContactDetailsSuggestionLabel(final int suggestionIndex) |
| + throws ExecutionException { |
| + assert suggestionIndex < mOptionLabelIds.length; |
| + return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
| + @Override |
| + public String call() { |
| + View view = mUI.getContactDetailsSectionForTest().findViewById( |
| + mOptionLabelIds[suggestionIndex]); |
| + return view == null ? null : ((TextView) view).getText().toString(); |
| + } |
| + }); |
| + } |
| + |
| + /** |
| + * Returns the label corresponding to the shipping address suggestion at the specified |
| + * |suggestionIndex|. Returns null if there is no suggestion at |suggestionIndex|. |
| + */ |
| + protected String getShippingAddressSuggestionLabel(final int suggestionIndex) |
| + throws ExecutionException { |
| + assert suggestionIndex < mOptionLabelIds.length; |
| + return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
| + @Override |
| + public String call() { |
| + View view = mUI.getShippingAddressSectionForTest().findViewById( |
| + mOptionLabelIds[suggestionIndex]); |
| + return view == null ? null : ((TextView) view).getText().toString(); |
| + } |
| + }); |
| + } |
| + |
| /** Selects the spinner value in the editor UI. */ |
| protected void setSpinnerSelectionInEditor(final int selection, CallbackHelper helper) |
| throws InterruptedException, TimeoutException { |