| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
| 6 | 6 |
| 7 import android.test.suitebuilder.annotation.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
| 8 | 8 |
| 9 import org.chromium.base.test.util.CommandLineFlags; | 9 import org.chromium.base.test.util.CommandLineFlags; |
| 10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
| 11 | 11 |
| 12 import java.util.concurrent.ExecutionException; | 12 import java.util.concurrent.ExecutionException; |
| 13 import java.util.concurrent.TimeoutException; | 13 import java.util.concurrent.TimeoutException; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * A payment integration test for checking whether user can make active payment
using a payment app. | 16 * A payment integration test for checking whether user can make a payment using
a payment app. |
| 17 */ | 17 */ |
| 18 @CommandLineFlags.Add("enable-blink-features=CanMakeActivePayment") | 18 @CommandLineFlags.Add("enable-blink-features=CanMakePayment") |
| 19 public class PaymentRequestPaymentAppActivePaymentQueryTest extends PaymentReque
stTestBase { | 19 public class PaymentRequestPaymentAppCanMakePaymentQueryTest extends PaymentRequ
estTestBase { |
| 20 public PaymentRequestPaymentAppActivePaymentQueryTest() { | 20 public PaymentRequestPaymentAppCanMakePaymentQueryTest() { |
| 21 super("payment_request_active_payment_query_bobpay_test.html"); | 21 super("payment_request_can_make_payment_query_bobpay_test.html"); |
| 22 } | 22 } |
| 23 | 23 |
| 24 @Override | 24 @Override |
| 25 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, | 25 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, |
| 26 TimeoutException {} | 26 TimeoutException {} |
| 27 | 27 |
| 28 @MediumTest | 28 @MediumTest |
| 29 @Feature({"Payments"}) | 29 @Feature({"Payments"}) |
| 30 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, | 30 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, |
| 31 TimeoutException { | 31 TimeoutException { |
| 32 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 32 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
| 33 expectResultContains(new String[]{"false, false"}); | 33 expectResultContains(new String[]{"false, false"}); |
| 34 | 34 |
| 35 clickNodeAndWait("otherBuy", mActivePaymentQueryResponded); | 35 clickNodeAndWait("otherBuy", mCanMakePaymentQueryResponded); |
| 36 expectResultContains(new String[]{"false, QuotaExceededError"}); | 36 expectResultContains(new String[]{"false, QuotaExceededError"}); |
| 37 } | 37 } |
| 38 | 38 |
| 39 @MediumTest | 39 @MediumTest |
| 40 @Feature({"Payments"}) | 40 @Feature({"Payments"}) |
| 41 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, | 41 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, |
| 42 TimeoutException { | 42 TimeoutException { |
| 43 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); | 43 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); |
| 44 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 44 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
| 45 expectResultContains(new String[]{"false, false"}); | 45 expectResultContains(new String[]{"false, false"}); |
| 46 | 46 |
| 47 clickNodeAndWait("otherBuy", mActivePaymentQueryResponded); | 47 clickNodeAndWait("otherBuy", mCanMakePaymentQueryResponded); |
| 48 expectResultContains(new String[]{"false, QuotaExceededError"}); | 48 expectResultContains(new String[]{"false, QuotaExceededError"}); |
| 49 } | 49 } |
| 50 | 50 |
| 51 @MediumTest | 51 @MediumTest |
| 52 @Feature({"Payments"}) | 52 @Feature({"Payments"}) |
| 53 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, | 53 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, |
| 54 TimeoutException { | 54 TimeoutException { |
| 55 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); | 55 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); |
| 56 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 56 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
| 57 expectResultContains(new String[]{"false, false"}); | 57 expectResultContains(new String[]{"false, false"}); |
| 58 | 58 |
| 59 clickNodeAndWait("otherBuy", mActivePaymentQueryResponded); | 59 clickNodeAndWait("otherBuy", mCanMakePaymentQueryResponded); |
| 60 expectResultContains(new String[]{"false, QuotaExceededError"}); | 60 expectResultContains(new String[]{"false, QuotaExceededError"}); |
| 61 } | 61 } |
| 62 | 62 |
| 63 @MediumTest | 63 @MediumTest |
| 64 @Feature({"Payments"}) | 64 @Feature({"Payments"}) |
| 65 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, | 65 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, |
| 66 TimeoutException { | 66 TimeoutException { |
| 67 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); | 67 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
| 68 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 68 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
| 69 expectResultContains(new String[]{"true, true"}); | 69 expectResultContains(new String[]{"true, true"}); |
| 70 | 70 |
| 71 clickNodeAndWait("otherBuy", mActivePaymentQueryResponded); | 71 clickNodeAndWait("otherBuy", mCanMakePaymentQueryResponded); |
| 72 expectResultContains(new String[]{"true, QuotaExceededError"}); | 72 expectResultContains(new String[]{"true, QuotaExceededError"}); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @MediumTest | 75 @MediumTest |
| 76 @Feature({"Payments"}) | 76 @Feature({"Payments"}) |
| 77 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, | 77 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, |
| 78 TimeoutException { | 78 TimeoutException { |
| 79 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); | 79 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); |
| 80 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 80 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
| 81 expectResultContains(new String[]{"true, true"}); | 81 expectResultContains(new String[]{"true, true"}); |
| 82 | 82 |
| 83 clickNodeAndWait("otherBuy", mActivePaymentQueryResponded); | 83 clickNodeAndWait("otherBuy", mCanMakePaymentQueryResponded); |
| 84 expectResultContains(new String[]{"true, QuotaExceededError"}); | 84 expectResultContains(new String[]{"true, QuotaExceededError"}); |
| 85 } | 85 } |
| 86 } | 86 } |
| OLD | NEW |