| 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.chrome.R; |
| 11 import org.chromium.chrome.browser.autofill.AutofillTestHelper; |
| 12 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 13 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
| 14 |
| 15 import java.util.concurrent.ExecutionException; |
| 16 import java.util.concurrent.TimeoutException; |
| 17 |
| 18 /** |
| 19 * A payment integration test for a merchant that requests email address from a
user that has |
| 20 * incomplete email address stored on disk. |
| 21 */ |
| 22 public class PaymentRequestIncompleteEmailTest extends PaymentRequestTestBase { |
| 23 public PaymentRequestIncompleteEmailTest() { |
| 24 // This merchant requests an email address. |
| 25 super("payment_request_email_test.html"); |
| 26 } |
| 27 |
| 28 @Override |
| 29 public void onMainActivityStarted() |
| 30 throws InterruptedException, ExecutionException, TimeoutException { |
| 31 AutofillTestHelper helper = new AutofillTestHelper(); |
| 32 // The user has an invalid email address on disk. |
| 33 helper.setProfile(new AutofillProfile("", "https://example.com", true, "
Jon Doe", "Google", |
| 34 "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "555-
555-5555", |
| 35 "jon.doe" /* invalid email address */, "en-US")); |
| 36 helper.setCreditCard(new CreditCard("", "https://example.com", true, tru
e, "Jon Doe", |
| 37 "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_
visa)); |
| 38 } |
| 39 |
| 40 /** Attempt to update the email with invalid data and cancel the transaction
. */ |
| 41 @MediumTest |
| 42 public void testEditIncompleteEmailAndCancel() |
| 43 throws InterruptedException, ExecutionException, TimeoutException { |
| 44 triggerUIAndWait(mReadyForInput); |
| 45 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 46 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); |
| 47 setTextInEditor(R.id.payments_edit_email_input, "gmail.com"); |
| 48 clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationEr
ror); |
| 49 clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToClose); |
| 50 clickAndWait(R.id.close_button, mDismissed); |
| 51 expectResultContains(new String[] {"Request cancelled"}); |
| 52 } |
| 53 |
| 54 /** Update the email with valid data and provide that to the merchant. */ |
| 55 @MediumTest |
| 56 public void testEditIncompleteEmailAndPay() |
| 57 throws InterruptedException, ExecutionException, TimeoutException { |
| 58 triggerUIAndWait(mReadyForInput); |
| 59 clickInContactInfoAndWait(R.id.payments_section, mReadyForInput); |
| 60 clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit
); |
| 61 setTextInEditor(R.id.payments_edit_email_input, "jon.doe@google.com"); |
| 62 clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay); |
| 63 clickAndWait(R.id.button_primary, mReadyForUnmaskInput); |
| 64 setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyTo
Unmask); |
| 65 clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed
); |
| 66 expectResultContains(new String[] {"jon.doe@google.com"}); |
| 67 } |
| 68 } |
| OLD | NEW |