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; | |
10 import org.chromium.base.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
11 import org.chromium.chrome.R; | 10 import org.chromium.chrome.R; |
12 import org.chromium.chrome.browser.autofill.AutofillTestHelper; | 11 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
13 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 12 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
14 | 13 |
15 import java.util.concurrent.ExecutionException; | 14 import java.util.concurrent.ExecutionException; |
16 import java.util.concurrent.TimeoutException; | 15 import java.util.concurrent.TimeoutException; |
17 | 16 |
18 /** | 17 /** |
19 * A payment integration test for checking whether user can make a payment via a
credit card. | 18 * A payment integration test for checking whether user can make a payment via a
credit card. |
20 * This user does not have a complete credit card on file. | 19 * This user does not have a complete credit card on file. |
21 */ | 20 */ |
22 @CommandLineFlags.Add("enable-blink-features=CanMakePayment") | |
23 public class PaymentRequestCcCanMakePaymentQueryNoCardTest extends PaymentReques
tTestBase { | 21 public class PaymentRequestCcCanMakePaymentQueryNoCardTest extends PaymentReques
tTestBase { |
24 public PaymentRequestCcCanMakePaymentQueryNoCardTest() { | 22 public PaymentRequestCcCanMakePaymentQueryNoCardTest() { |
25 super("payment_request_can_make_payment_query_cc_test.html"); | 23 super("payment_request_can_make_payment_query_cc_test.html"); |
26 } | 24 } |
27 | 25 |
28 @Override | 26 @Override |
29 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, | 27 public void onMainActivityStarted() throws InterruptedException, ExecutionEx
ception, |
30 TimeoutException { | 28 TimeoutException { |
31 // The user has an incomplete credit card on file. This is not sufficien
t for | 29 // The user has an incomplete credit card on file. This is not sufficien
t for |
32 // canMakePayment() to return true. | 30 // canMakePayment() to return true. |
33 new AutofillTestHelper().setCreditCard(new CreditCard("", "https://examp
le.com", true, true, | 31 new AutofillTestHelper().setCreditCard(new CreditCard("", "https://examp
le.com", true, true, |
34 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d
rawable.pr_visa, | 32 "Jon Doe", "4111111111111111", "1111", "12", "2050", "visa", R.d
rawable.pr_visa, |
35 "" /* billingAddressId */, "" /* serverId */)); | 33 "" /* billingAddressId */, "" /* serverId */)); |
36 } | 34 } |
37 | 35 |
38 @MediumTest | 36 @MediumTest |
39 @Feature({"Payments"}) | 37 @Feature({"Payments"}) |
40 public void testCannotMakePayment() throws InterruptedException, ExecutionEx
ception, | 38 public void testCannotMakePayment() throws InterruptedException, ExecutionEx
ception, |
41 TimeoutException { | 39 TimeoutException { |
42 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); | 40 installPaymentApp(HAVE_INSTRUMENTS, DELAYED_RESPONSE); |
43 triggerUIAndWait(mCanMakePaymentQueryResponded); | 41 triggerUIAndWait(mCanMakePaymentQueryResponded); |
44 expectResultContains(new String[]{"false"}); | 42 expectResultContains(new String[]{"false"}); |
45 } | 43 } |
46 } | 44 } |
OLD | NEW |