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