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.AutofillProfile; | 13 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 14 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
15 | 15 |
16 import java.util.concurrent.ExecutionException; | 16 import java.util.concurrent.ExecutionException; |
17 import java.util.concurrent.TimeoutException; | 17 import java.util.concurrent.TimeoutException; |
18 | 18 |
19 /** | 19 /** |
20 * A payment integration test for checking whether user can make active payment
via either payment | 20 * A payment integration test for checking whether user can make a payment via e
ither payment |
21 * app or a credit card. This user has a complete credit card on file. | 21 * app or a credit card. This user has a complete credit card on file. |
22 */ | 22 */ |
23 @CommandLineFlags.Add("enable-blink-features=CanMakeActivePayment") | 23 @CommandLineFlags.Add("enable-blink-features=CanMakePayment") |
24 public class PaymentRequestActivePaymentQueryTest extends PaymentRequestTestBase
{ | 24 public class PaymentRequestCanMakePaymentQueryTest extends PaymentRequestTestBas
e { |
25 public PaymentRequestActivePaymentQueryTest() { | 25 public PaymentRequestCanMakePaymentQueryTest() { |
26 super("payment_request_active_payment_query_test.html"); | 26 super("payment_request_can_make_payment_query_test.html"); |
27 } | 27 } |
28 | 28 |
29 @Override | 29 @Override |
30 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, | 30 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, |
31 TimeoutException { | 31 TimeoutException { |
32 // The user has a complete credit card on file. This is sufficient for | 32 // The user has a complete credit card on file. This is sufficient for |
33 // canMakeActivePayment() to return true. | 33 // canMakePayment() to return true. |
34 AutofillTestHelper helper = new AutofillTestHelper(); | 34 AutofillTestHelper helper = new AutofillTestHelper(); |
35 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt
ps://example.com", | 35 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt
ps://example.com", |
36 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "
", "90291", "", | 36 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "
", "90291", "", |
37 "US", "555-555-5555", "", "en-US")); | 37 "US", "555-555-5555", "", "en-US")); |
38 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", | 38 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", |
39 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, | 39 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, |
40 billingAddressId, "" /* serverId */)); | 40 billingAddressId, "" /* serverId */)); |
41 } | 41 } |
42 | 42 |
43 @MediumTest | 43 @MediumTest |
44 @Feature({"Payments"}) | 44 @Feature({"Payments"}) |
45 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, | 45 public void testNoBobPayInstalled() throws InterruptedException, ExecutionEx
ception, |
46 TimeoutException { | 46 TimeoutException { |
47 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 47 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
48 expectResultContains(new String[]{"true"}); | 48 expectResultContains(new String[]{"true"}); |
49 } | 49 } |
50 | 50 |
51 @MediumTest | 51 @MediumTest |
52 @Feature({"Payments"}) | 52 @Feature({"Payments"}) |
53 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, | 53 public void testNoInstrumentsInFastBobPay() throws InterruptedException, Exe
cutionException, |
54 TimeoutException { | 54 TimeoutException { |
55 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); | 55 installPaymentApp(NO_INSTRUMENTS, IMMEDIATE_RESPONSE); |
56 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 56 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
57 expectResultContains(new String[]{"true"}); | 57 expectResultContains(new String[]{"true"}); |
58 } | 58 } |
59 | 59 |
60 @MediumTest | 60 @MediumTest |
61 @Feature({"Payments"}) | 61 @Feature({"Payments"}) |
62 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, | 62 public void testNoInstrumentsInSlowBobPay() throws InterruptedException, Exe
cutionException, |
63 TimeoutException { | 63 TimeoutException { |
64 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); | 64 installPaymentApp(NO_INSTRUMENTS, DELAYED_RESPONSE); |
65 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 65 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
66 expectResultContains(new String[]{"true"}); | 66 expectResultContains(new String[]{"true"}); |
67 } | 67 } |
68 | 68 |
69 @MediumTest | 69 @MediumTest |
70 @Feature({"Payments"}) | 70 @Feature({"Payments"}) |
71 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, | 71 public void testPayViaFastBobPay() throws InterruptedException, ExecutionExc
eption, |
72 TimeoutException { | 72 TimeoutException { |
73 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); | 73 installPaymentApp(HAVE_INSTRUMENTS, IMMEDIATE_RESPONSE); |
74 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 74 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
75 expectResultContains(new String[]{"true"}); | 75 expectResultContains(new String[]{"true"}); |
76 } | 76 } |
77 | 77 |
78 @MediumTest | 78 @MediumTest |
79 @Feature({"Payments"}) | 79 @Feature({"Payments"}) |
80 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, | 80 public void testPayViaSlowBobPay() throws InterruptedException, ExecutionExc
eption, |
81 TimeoutException { | 81 TimeoutException { |
82 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); | 82 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); |
83 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | 83 openPageAndClickBuyAndWait(mCanMakePaymentQueryResponded); |
84 expectResultContains(new String[]{"true"}); | 84 expectResultContains(new String[]{"true"}); |
85 } | 85 } |
86 } | 86 } |
OLD | NEW |