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

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

Issue 2173383002: [Merge M-53] [Payments] Use the correct index when checking addresses (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
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 8766cc78492295c99777f0dfd1ea611c0d19d32d..d0f4df1a54681043e26a846ec565bd35ec91009c 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
@@ -22,6 +22,7 @@ import org.chromium.chrome.browser.payments.PaymentAppFactory.PaymentAppFactoryA
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.PaymentRequestSection.OptionSection.OptionRow;
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI;
import org.chromium.chrome.browser.payments.ui.PaymentRequestUI.PaymentRequestObserverForTest;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
@@ -64,6 +65,7 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput;
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay;
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToClose;
+ protected final PaymentsCallbackHelper<PaymentRequestUI> mSelectionChecked;
protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady;
protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyForUnmaskInput;
protected final PaymentsCallbackHelper<CardUnmaskPrompt> mReadyToUnmask;
@@ -86,6 +88,7 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
mReadyForInput = new PaymentsCallbackHelper<>();
mReadyToPay = new PaymentsCallbackHelper<>();
mReadyToClose = new PaymentsCallbackHelper<>();
+ mSelectionChecked = new PaymentsCallbackHelper<>();
mResultReady = new PaymentsCallbackHelper<>();
mReadyForUnmaskInput = new PaymentsCallbackHelper<>();
mReadyToUnmask = new PaymentsCallbackHelper<>();
@@ -325,7 +328,28 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
}
/**
- * Returns the the number of shipping address suggestions,
+ * Clicks on the label corresponding to the shipping address suggestion at the specified
+ * |suggestionIndex|.
+ * @throws InterruptedException
+ */
+ protected void clickOnShippingAddressSuggestionOptionAndWait(
+ final int suggestionIndex, CallbackHelper helper)
+ throws ExecutionException, TimeoutException, InterruptedException {
+ assert (suggestionIndex < getNumberOfShippingAddressSuggestions());
+
+ int callCount = helper.getCallCount();
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ ((OptionSection) mUI.getShippingAddressSectionForTest())
+ .getOptionLabelsForTest(suggestionIndex).performClick();
+ }
+ });
+ helper.waitForCallback(callCount);
+ }
+
+ /**
+ * Returns the the number of shipping address suggestions.
*/
protected int getNumberOfShippingAddressSuggestions() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() {
@@ -337,6 +361,18 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
});
}
+ /** Returns the {@link OptionRow} at the given index for the shipping address section. */
+ protected OptionRow getShippingAddressOptionRowAtIndex(final int index)
+ throws ExecutionException {
+ return ThreadUtils.runOnUiThreadBlocking(new Callable<OptionRow>() {
+ @Override
+ public OptionRow call() {
+ return ((OptionSection) mUI.getShippingAddressSectionForTest())
+ .getOptionRowAtIndex(index);
+ }
+ });
+ }
+
/** Selects the spinner value in the editor UI for credit cards. */
protected void setSpinnerSelectionsInCardEditorAndWait(final int[] selections,
CallbackHelper helper) throws InterruptedException, TimeoutException {
@@ -497,6 +533,12 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
}
@Override
+ public void onPaymentRequestSelectionChecked(PaymentRequestUI ui) {
+ ThreadUtils.assertOnUiThread();
+ mSelectionChecked.notifyCalled(ui);
+ }
+
+ @Override
public void onPaymentRequestResultReady(PaymentRequestUI ui) {
ThreadUtils.assertOnUiThread();
mResultReady.notifyCalled(ui);
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestDynamicShippingMultipleAddressesTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698