| Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..cb56745ee83fe286a8ae5d56c862cdf5034e5bac
|
| --- /dev/null
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestPhoneTest.java
|
| @@ -0,0 +1,77 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.chrome.browser.payments;
|
| +
|
| +import android.content.DialogInterface;
|
| +import android.test.suitebuilder.annotation.MediumTest;
|
| +
|
| +import org.chromium.chrome.R;
|
| +import org.chromium.chrome.browser.autofill.AutofillTestHelper;
|
| +import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
|
| +import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
|
| +
|
| +import java.util.concurrent.ExecutionException;
|
| +import java.util.concurrent.TimeoutException;
|
| +
|
| +/**
|
| + * A payment integration test for a merchant that requests phone number.
|
| + */
|
| +public class PaymentRequestPhoneTest extends PaymentRequestTestBase {
|
| + public PaymentRequestPhoneTest() {
|
| + super("payment_request_phone_test.html");
|
| + }
|
| +
|
| + @Override
|
| + public void onMainActivityStarted()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + AutofillTestHelper helper = new AutofillTestHelper();
|
| + helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google",
|
| + "340 Main St", "CA", "Los Angeles", "", "90291", "", "US", "555-555-5555",
|
| + "jon.doe@google.com", "en-US"));
|
| + helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe",
|
| + "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_visa));
|
| + }
|
| +
|
| + @MediumTest
|
| + public void testPay() throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyToPay);
|
| + clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
|
| + typeInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123",
|
| + mReadyForUnmaskInput.getTarget(), mReadyToUnmask);
|
| + clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE,
|
| + mReadyToUnmask.getTarget(), mDismissed);
|
| + expectResultContains(new String[] {"555-555-5555"});
|
| + }
|
| +
|
| + @MediumTest
|
| + public void testAddInvalidPhoneAndCancel()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyToPay);
|
| + clickAndWait(CONSTRAINT_CONTACT_DETAILS, R.id.payments_section, mReadyForInput);
|
| + clickAndWait(CONSTRAINT_CONTACT_DETAILS, R.id.payments_add_option_button, mReadyToEdit);
|
| + typeInEditDialog(R.id.payments_edit_phone_input, "+++");
|
| + clickAndWait(
|
| + CONSTRAINT_EDIT_DIALOG, R.id.payments_edit_done_button, mEditorValidationError);
|
| + clickAndWait(CONSTRAINT_EDIT_DIALOG, R.id.payments_edit_cancel_button, mEditorDismissed);
|
| + clickAndWait(R.id.close_button, mDismissed);
|
| + expectResultContains(new String[] {"Request cancelled"});
|
| + }
|
| +
|
| + @MediumTest
|
| + public void testAddPhoneAndPay()
|
| + throws InterruptedException, ExecutionException, TimeoutException {
|
| + triggerUIAndWait(mReadyToPay);
|
| + clickAndWait(CONSTRAINT_CONTACT_DETAILS, R.id.payments_section, mReadyForInput);
|
| + clickAndWait(CONSTRAINT_CONTACT_DETAILS, R.id.payments_add_option_button, mReadyToEdit);
|
| + typeInEditDialog(R.id.payments_edit_phone_input, "999-999-9999");
|
| + clickAndWait(CONSTRAINT_EDIT_DIALOG, R.id.payments_edit_done_button, mReadyToPay);
|
| + clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
|
| + typeInCardUnmaskDialogAndWait(
|
| + R.id.card_unmask_input, "123", mReadyForUnmaskInput.getTarget(), mReadyToUnmask);
|
| + clickCardUnmaskButtonAndWait(
|
| + DialogInterface.BUTTON_POSITIVE, mReadyToUnmask.getTarget(), mDismissed);
|
| + expectResultContains(new String[] {"999-999-9999"});
|
| + }
|
| +}
|
|
|