| 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 a credit card. | |
| 21 * This user has a complete credit card on file. | |
| 22 */ | |
| 23 @CommandLineFlags.Add("enable-blink-features=CanMakeActivePayment") | |
| 24 public class PaymentRequestCcActivePaymentQueryTest extends PaymentRequestTestBa
se { | |
| 25 public PaymentRequestCcActivePaymentQueryTest() { | |
| 26 super("payment_request_active_payment_query_cc_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 testCanMakeActivePayment() throws InterruptedException, Executio
nException, | |
| 46 TimeoutException { | |
| 47 openPageAndClickBuyAndWait(mActivePaymentQueryResponded); | |
| 48 expectResultContains(new String[]{"true"}); | |
| 49 | |
| 50 // Repeating a query does not count against the quota. | |
| 51 clickNodeAndWait("buy", mActivePaymentQueryResponded); | |
| 52 expectResultContains(new String[]{"true"}); | |
| 53 | |
| 54 clickNodeAndWait("buy", mActivePaymentQueryResponded); | |
| 55 expectResultContains(new String[]{"true"}); | |
| 56 | |
| 57 // Different queries are throttled for a period of time. | |
| 58 clickNodeAndWait("other-buy", mActivePaymentQueryResponded); | |
| 59 expectResultContains(new String[]{"Query quota exceeded"}); | |
| 60 | |
| 61 // Repeating the same query again does not count against the quota. | |
| 62 clickNodeAndWait("buy", mActivePaymentQueryResponded); | |
| 63 expectResultContains(new String[]{"true"}); | |
| 64 } | |
| 65 } | |
| OLD | NEW |