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

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

Issue 2149263003: [Merge M-53] Suggest complete addresses and contact details first and limit to the top four suggest… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: 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
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultipleContactDetailsTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c4cc7355ec39f084ce7b6ab1083b8c1dab2ff253..2444005c8c58698092987572a9b3c28ccaeb72b5 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
@@ -18,6 +18,7 @@ import org.chromium.chrome.browser.autofill.CardUnmaskPrompt;
import org.chromium.chrome.browser.autofill.CardUnmaskPrompt.CardUnmaskObserverForTest;
import org.chromium.chrome.browser.payments.PaymentRequestImpl.PaymentRequestServiceObserverForTest;
import org.chromium.chrome.browser.payments.ui.EditorTextField;
+import org.chromium.chrome.browser.payments.ui.PaymentRequestSection.OptionSection;
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI;
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
@@ -205,6 +206,66 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
});
}
+ /**
+ * Returns the label corresponding to the contact detail suggestion at the specified
+ * |suggestionIndex|.
+ */
+ protected String getContactDetailsSuggestionLabel(final int suggestionIndex)
+ throws ExecutionException {
+ assert (suggestionIndex < getNumberOfContactDetailSuggestions());
+
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() {
+ @Override
+ public String call() {
+ return ((OptionSection) mUI.getContactDetailsSectionForTest())
+ .getOptionLabelsForTest(suggestionIndex).getText().toString();
+ }
+ });
+ }
+
+ /**
+ * Returns the the number of contact detail suggestions,
+ */
+ protected int getNumberOfContactDetailSuggestions() throws ExecutionException {
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ return ((OptionSection) mUI.getContactDetailsSectionForTest())
+ .getNumberOfOptionLabelsForTest();
+ }
+ });
+ }
+
+ /**
+ * Returns the label corresponding to the shipping address suggestion at the specified
+ * |suggestionIndex|.
+ */
+ protected String getShippingAddressSuggestionLabel(final int suggestionIndex)
+ throws ExecutionException {
+ assert (suggestionIndex < getNumberOfShippingAddressSuggestions());
+
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() {
+ @Override
+ public String call() {
+ return ((OptionSection) mUI.getShippingAddressSectionForTest())
+ .getOptionLabelsForTest(suggestionIndex).getText().toString();
+ }
+ });
+ }
+
+ /**
+ * Returns the the number of shipping address suggestions,
+ */
+ protected int getNumberOfShippingAddressSuggestions() throws ExecutionException {
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
+ @Override
+ public Integer call() {
+ return ((OptionSection) mUI.getShippingAddressSectionForTest())
+ .getNumberOfOptionLabelsForTest();
+ }
+ });
+ }
+
/** Selects the spinner value in the editor UI. */
protected void setSpinnerSelectionInEditor(final int selection, CallbackHelper helper)
throws InterruptedException, TimeoutException {
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestMultipleContactDetailsTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698