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

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

Issue 2467393002: Add canMakeActivePayment() method to web payments. (Closed)
Patch Set: Fix FindBugs Created 4 years, 1 month 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/PaymentRequestActivePaymentQueryTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..96ee6f01f9ec4e8b1d198a72438d62074d84e505
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestActivePaymentQueryTest.java
@@ -0,0 +1,86 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments;
+
+import android.test.suitebuilder.annotation.MediumTest;
+
+import org.chromium.base.test.util.CommandLineFlags;
+import org.chromium.base.test.util.Feature;
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.autofill.AutofillTestHelper;
+import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
+import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * A payment integration test for checking whether user can make active payment via either payment
+ * app or a credit card. This user has a complete credit card on file.
+ */
+@CommandLineFlags.Add("enable-blink-features=CanMakeActivePayment")
+public class PaymentRequestActivePaymentQueryTest extends PaymentRequestTestBase {
+ public PaymentRequestActivePaymentQueryTest() {
+ super("payment_request_active_payment_query_test.html");
+ }
+
+ @Override
+ public void onMainActivityStarted() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ // The user has a complete credit card on file. This is sufficient for
+ // canMakeActivePayment() to return true.
+ AutofillTestHelper helper = new AutofillTestHelper();
+ String billingAddressId = helper.setProfile(new AutofillProfile("", "https://example.com",
+ true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "", "90291", "",
+ "US", "555-555-5555", "", "en-US"));
+ helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe",
+ "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_visa,
+ billingAddressId, "" /* serverId */));
+ }
+
+ @MediumTest
+ @Feature({"Payments"})
+ public void testNoBobPayInstalled() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ triggerUIAndWait(mActivePaymentQueryResponded);
+ expectResultContains(new String[]{"true"});
+ }
+
+ @MediumTest
+ @Feature({"Payments"})
+ public void testNoInstrumentsInFastBobPay() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE);
+ triggerUIAndWait(mActivePaymentQueryResponded);
+ expectResultContains(new String[]{"true"});
+ }
+
+ @MediumTest
+ @Feature({"Payments"})
+ public void testNoInstrumentsInSlowBobPay() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE);
+ triggerUIAndWait(mActivePaymentQueryResponded);
+ expectResultContains(new String[]{"true"});
+ }
+
+ @MediumTest
+ @Feature({"Payments"})
+ public void testPayViaFastBobPay() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE);
+ triggerUIAndWait(mActivePaymentQueryResponded);
+ expectResultContains(new String[]{"true"});
+ }
+
+ @MediumTest
+ @Feature({"Payments"})
+ public void testPayViaSlowBobPay() throws InterruptedException, ExecutionException,
+ TimeoutException {
+ installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE);
+ triggerUIAndWait(mActivePaymentQueryResponded);
+ expectResultContains(new String[]{"true"});
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698