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 import org.chromium.chrome.R; | 11 import org.chromium.chrome.R; |
12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
13 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 13 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
14 | 14 |
15 import java.util.concurrent.ExecutionException; | 15 import java.util.concurrent.ExecutionException; |
16 import java.util.concurrent.TimeoutException; | 16 import java.util.concurrent.TimeoutException; |
17 | 17 |
18 /** | 18 /** |
19 * A payment integration test for checking whether user can make active payment
via either payment | 19 * A payment integration test for checking whether user can make a payment via e
ither payment |
20 * app or a credit card. This user does not have a complete credit card on file. | 20 * app or a credit card. This user does not have a complete credit card on file. |
21 */ | 21 */ |
22 @CommandLineFlags.Add("enable-blink-features=CanMakeActivePayment") | 22 @CommandLineFlags.Add("enable-blink-features=CanMakePayment") |
23 public class PaymentRequestActivePaymentQueryNoCardTest extends PaymentRequestTe
stBase { | 23 public class PaymentRequestCanMakePaymentQueryNoCardTest extends PaymentRequestT
estBase { |
24 public PaymentRequestActivePaymentQueryNoCardTest() { | 24 public PaymentRequestCanMakePaymentQueryNoCardTest() { |
25 super("payment_request_active_payment_query_test.html"); | 25 super("payment_request_can_make_payment_query_test.html"); |
26 } | 26 } |
27 | 27 |
28 @Override | 28 @Override |
29 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, | 29 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, |
30 TimeoutException { | 30 TimeoutException { |
31 // The user has an incomplete credit card on file. This is not sufficien
t for | 31 // The user has an incomplete credit card on file. This is not sufficien
t for |
32 // canMakeActivePayment() to return true. | 32 // canMakePayment() to return true. |
33 new AutofillTestHelper().setCreditCard(new CreditCard("", "https://examp
le.com", true, true, | 33 new AutofillTestHelper().setCreditCard(new CreditCard("", "https://examp
le.com", true, true, |
34 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d
rawable.pr_visa, | 34 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d
rawable.pr_visa, |
35 "" /* billingAddressId */, "" /* serverId */)); | 35 "" /* billingAddressId */, "" /* serverId */)); |
36 } | 36 } |
37 | 37 |
38 @MediumTest | 38 @MediumTest |
39 @Feature({"Payments"}) | 39 @Feature({"Payments"}) |
40 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, | 40 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, |
41 TimeoutException { | 41 TimeoutException { |
42 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 42 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
43 expectResultContains(new String[]{"false"}); | 43 expectResultContains(new String[]{"false"}); |
44 } | 44 } |
45 | 45 |
46 @MediumTest | 46 @MediumTest |
47 @Feature({"Payments"}) | 47 @Feature({"Payments"}) |
48 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, | 48 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, |
49 TimeoutException { | 49 TimeoutException { |
50 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); | 50 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); |
51 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 51 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
52 expectResultContains(new String[]{"false"}); | 52 expectResultContains(new String[]{"false"}); |
53 } | 53 } |
54 | 54 |
55 @MediumTest | 55 @MediumTest |
56 @Feature({"Payments"}) | 56 @Feature({"Payments"}) |
57 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, | 57 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, |
58 TimeoutException { | 58 TimeoutException { |
59 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); | 59 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); |
60 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 60 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
61 expectResultContains(new String[]{"false"}); | 61 expectResultContains(new String[]{"false"}); |
62 } | 62 } |
63 | 63 |
64 @MediumTest | 64 @MediumTest |
65 @Feature({"Payments"}) | 65 @Feature({"Payments"}) |
66 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, | 66 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, |
67 TimeoutException { | 67 TimeoutException { |
68 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); | 68 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
69 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 69 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
70 expectResultContains(new String[]{"true"}); | 70 expectResultContains(new String[]{"true"}); |
71 } | 71 } |
72 | 72 |
73 @MediumTest | 73 @MediumTest |
74 @Feature({"Payments"}) | 74 @Feature({"Payments"}) |
75 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, | 75 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, |
76 TimeoutException { | 76 TimeoutException { |
77 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); | 77 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); |
78 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 78 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
79 expectResultContains(new String[]{"true"}); | 79 expectResultContains(new String[]{"true"}); |
80 } | 80 } |
81 } | 81 } |
OLD | NEW |