OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.payments; |
| 6 |
| 7 import android.test.suitebuilder.annotation.MediumTest; |
| 8 |
| 9 import org.chromium.base.test.util.Feature; |
| 10 import org.chromium.chrome.R; |
| 11 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
| 12 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
| 13 |
| 14 import java.util.concurrent.ExecutionException; |
| 15 import java.util.concurrent.TimeoutException; |
| 16 |
| 17 /** |
| 18 * A payment integration test for checking whether user can make active payment
via either payment |
| 19 * app or a credit card. This user does not have a complete credit card on file. |
| 20 */ |
| 21 public class PaymentRequestActivePaymentQueryNoCardTest extends PaymentRequestTe
stBase { |
| 22 public PaymentRequestActivePaymentQueryNoCardTest() { |
| 23 super("payment_request_active_payment_query_test.html"); |
| 24 } |
| 25 |
| 26 @Override |
| 27 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, |
| 28 TimeoutException { |
| 29 // The user has an incomplete credit card on file. This is not sufficien
t for |
| 30 // canMakeActivePayment() to return true. |
| 31 new AutofillTestHelper().setCreditCard(new CreditCard("", "https://examp
le.com", true, true, |
| 32 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d
rawable.pr_visa, |
| 33 "" /* billingAddressId */, "" /* serverId */)); |
| 34 } |
| 35 |
| 36 @MediumTest |
| 37 @Feature({"Payments"}) |
| 38 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, |
| 39 TimeoutException { |
| 40 triggerUIAndWait(mActivePaymentQueryResponded); |
| 41 expectResultContains(new String[]{"false"}); |
| 42 } |
| 43 |
| 44 @MediumTest |
| 45 @Feature({"Payments"}) |
| 46 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, |
| 47 TimeoutException { |
| 48 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); |
| 49 triggerUIAndWait(mActivePaymentQueryResponded); |
| 50 expectResultContains(new String[]{"false"}); |
| 51 } |
| 52 |
| 53 @MediumTest |
| 54 @Feature({"Payments"}) |
| 55 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, |
| 56 TimeoutException { |
| 57 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); |
| 58 triggerUIAndWait(mActivePaymentQueryResponded); |
| 59 expectResultContains(new String[]{"false"}); |
| 60 } |
| 61 |
| 62 @MediumTest |
| 63 @Feature({"Payments"}) |
| 64 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, |
| 65 TimeoutException { |
| 66 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
| 67 triggerUIAndWait(mActivePaymentQueryResponded); |
| 68 expectResultContains(new String[]{"true"}); |
| 69 } |
| 70 |
| 71 @MediumTest |
| 72 @Feature({"Payments"}) |
| 73 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, |
| 74 TimeoutException { |
| 75 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); |
| 76 triggerUIAndWait(mActivePaymentQueryResponded); |
| 77 expectResultContains(new String[]{"true"}); |
| 78 } |
| 79 } |
OLD | NEW |