| 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.content.DialogInterface; | |
| 8 import android.test.suitebuilder.annotation.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 a merchant that requests contact details from
a user that has | |
| 21 * incomplete contact details stored on disk. | |
| 22 */ | |
| 23 public class PaymentRequestIncompleteContactDetailsTest extends PaymentRequestTe
stBase { | |
| 24 public PaymentRequestIncompleteContactDetailsTest() { | |
| 25 // This merchant requests both a phone number and an email address. | |
| 26 super("payment_request_contact_details_test.html"); | |
| 27 } | |
| 28 | |
| 29 @Override | |
| 30 public void onMainActivityStarted() | |
| 31 throws InterruptedException, ExecutionException, TimeoutException { | |
| 32 AutofillTestHelper helper = new AutofillTestHelper(); | |
| 33 // The user has an invalid email address on disk. | |
| 34 String billingAddressId = helper.setProfile(new AutofillProfile("", "htt
ps://example.com", | |
| 35 true, "Jon Doe", "Google", "340 Main St", "CA", "Los Angeles", "
", "90291", "", | |
| 36 "US", "333-333-3333", "jon.doe" /* invalid email address */, "en
-US")); | |
| 37 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", | |
| 38 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa, | |
| 39 billingAddressId, "" /* serverId */)); | |
| 40 } | |
| 41 | |
| 42 /** Attempt to update the contact information with invalid data and cancel t
he transaction. */ | |
| 43 @MediumTest | |
| 44 @Feature({"Payments"}) | |
| 45 public void testEditIncompleteContactAndCancel() | |
| 46 throws InterruptedException, ExecutionException, TimeoutException { | |
| 47 triggerUIAndWait(mReadyForInput); | |
| 48 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | |
| 49 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | |
| 50 setTextInEditorAndWait(new String[] {"---", "jane.jones"}, mEditorTextUp
date); | |
| 51 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); | |
| 52 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyForInput); | |
| 53 clickAndWait(R.id.close_button, mDismissed); | |
| 54 expectResultContains(new String[] {"Request cancelled"}); | |
| 55 } | |
| 56 | |
| 57 /** Update the contact information with valid data and provide that to the m
erchant. */ | |
| 58 @MediumTest | |
| 59 @Feature({"Payments"}) | |
| 60 public void testEditIncompleteContactAndPay() | |
| 61 throws InterruptedException, ExecutionException, TimeoutException { | |
| 62 triggerUIAndWait(mReadyForInput); | |
| 63 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); | |
| 64 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); | |
| 65 setTextInEditorAndWait(new String[] {"555-555-5555", "jon.doe@google.com
"}, | |
| 66 mEditorTextUpdate); | |
| 67 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); | |
| 68 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); | |
| 69 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); | |
| 70 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); | |
| 71 expectResultContains(new String[] {"555-555-5555", "jon.doe@google.com"}
); | |
| 72 } | |
| 73 } | |
| OLD | NEW |