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

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

Issue 2193293003: Don't crash when closing UI while waiting for apps to respond. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/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.
*/

Powered by Google App Engine
This is Rietveld 408576698