OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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.content.DialogInterface; |
| 8 import android.support.test.filters.MediumTest; |
| 9 |
| 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 verifying the PaymentResponse contains the |
| 21 * free-form identifier specified in PaymentDetailsInit. |
| 22 */ |
| 23 public class PaymentRequestIdTest extends PaymentRequestTestBase { |
| 24 public PaymentRequestIdTest() { |
| 25 super("payment_request_id_test.html"); |
| 26 } |
| 27 |
| 28 @Override |
| 29 public void onMainActivityStarted() |
| 30 throws InterruptedException, ExecutionException, TimeoutException { |
| 31 AutofillTestHelper helper = new AutofillTestHelper(); |
| 32 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt
ps://example.com", |
| 33 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "
", "90291", "", |
| 34 "US", "555-555-5555", "", "en-US")); |
| 35 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", |
| 36 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, |
| 37 billingAddressId, "" /* serverId */)); |
| 38 } |
| 39 |
| 40 /** |
| 41 * Submit the payment information without shipping address or shipping optio
ns to the merchant |
| 42 * when the user clicks "Pay." |
| 43 */ |
| 44 @MediumTest |
| 45 @Feature({"Payments"}) |
| 46 public void testPaymentResponse() |
| 47 throws InterruptedException, ExecutionException, TimeoutException { |
| 48 triggerUIAndWait(mReadyToPay); |
| 49 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| 50 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); |
| 51 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
| 52 expectResultContains(new String[] {"my_payment_id"}); |
| 53 } |
| 54 } |
OLD | NEW |