Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java |
index 8c17d1279688435f01f6492a3e07b951bbd87942..7312837d881830573f9e4d6ddc29626f268a73f6 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPaymentAppTest.java |
@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.payments; |
import android.test.suitebuilder.annotation.MediumTest; |
+import org.chromium.base.ThreadUtils; |
import org.chromium.chrome.R; |
import java.util.concurrent.ExecutionException; |
@@ -59,6 +60,43 @@ public class PaymentRequestPaymentAppTest extends PaymentRequestTestBase { |
} |
/** |
+ * If the payment app responds with more instruments after the UI has been dismissed, don't |
+ * crash. |
+ */ |
+ @MediumTest |
+ public void testPaymentWithInstrumentsAppResponseAfterDismissShouldNotCrash() |
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ final BobPay app = installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
+ triggerUIAndWait(mReadyForInput); |
+ clickAndWait(R.id.close_button, mDismissed); |
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
+ @Override |
+ public void run() { |
+ app.respond(); |
+ } |
+ }); |
+ expectResultContains(new String[]{"show() rejected", "Request cancelled"}); |
+ } |
+ |
+ /** |
+ * If the payment app responds with no instruments after the UI has been dismissed, don't crash. |
+ */ |
+ @MediumTest |
+ public void testPaymentAppNoInstrumentsResponseAfterDismissShouldNotCrash() |
+ throws InterruptedException, ExecutionException, TimeoutException { |
+ final BobPay app = installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); |
+ triggerUIAndWait(mShowFailed); |
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
+ @Override |
+ public void run() { |
+ app.respond(); |
+ } |
+ }); |
+ expectResultContains( |
+ new String[]{"show() rejected", "The payment method is not supported"}); |
+ } |
+ |
+ /** |
* If Bob Pay is supported and installed, user should be able to pay with it. Here Bob Pay |
* responds to Chrome immediately. |
*/ |