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

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

Issue 2120973002: [Payments] Show complete profiles first and limit to 4 suggestions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 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/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 {

Powered by Google App Engine
This is Rietveld 408576698