Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2304)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java

Issue 2081533002: Edit contacts UI for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contactDetails
Patch Set: Addressed comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..258cc373bc456cb95662a7323216772b4e20daf3
--- /dev/null
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestIncompleteContactDetailsTest.java
@@ -0,0 +1,70 @@
+// 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 contact details from a user that has
+ * incomplete contact details stored on disk.
+ */
+public class PaymentRequestIncompleteContactDetailsTest extends PaymentRequestTestBase {
+ public PaymentRequestIncompleteContactDetailsTest() {
+ // This merchant requests both a phone number and an email address.
+ super("payment_request_contact_details_test.html");
+ }
+
+ @Override
+ public void onMainActivityStarted()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ AutofillTestHelper helper = new AutofillTestHelper();
+ // The user has an invalid phone number and an invalid email address on disk.
+ helper.setProfile(new AutofillProfile("", "https://example.com", true, "Jon Doe", "Google",
+ "340 Main St", "CA", "Los Angeles", "", "90291", "", "US",
+ "+++" /* invalid phone number */, "jon.doe" /* invalid email address */, "en-US"));
+ helper.setCreditCard(new CreditCard("", "https://example.com", true, true, "Jon Doe",
+ "4111111111111111", "1111", "12", "2050", "visa", R.drawable.pr_visa));
+ }
+
+ /** Attempt to update the contact information with invalid data and cancel the transaction. */
+ @MediumTest
+ public void testEditIncompleteContactAndCancel()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ triggerUIAndWait(mReadyForInput);
+ clickInContactInfoAndWait(R.id.payments_section, mReadyForInput);
+ clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit);
+ setTextInEditor(R.id.payments_edit_phone_input, "---");
+ setTextInEditor(R.id.payments_edit_email_input, "jane.jones");
+ clickInEditorAndWait(R.id.payments_edit_done_button, mEditorValidationError);
+ clickInEditorAndWait(R.id.payments_edit_cancel_button, mReadyToClose);
+ clickAndWait(R.id.close_button, mDismissed);
+ expectResultContains(new String[] {"Request cancelled"});
+ }
+
+ /** Update the contact information with valid data and provide that to the merchant. */
+ @MediumTest
+ public void testEditIncompleteContactAndPay()
+ throws InterruptedException, ExecutionException, TimeoutException {
+ triggerUIAndWait(mReadyForInput);
+ clickInContactInfoAndWait(R.id.payments_section, mReadyForInput);
+ clickInContactInfoAndWait(R.id.payments_first_radio_button, mReadyToEdit);
+ setTextInEditor(R.id.payments_edit_phone_input, "555-555-5555");
+ setTextInEditor(R.id.payments_edit_email_input, "jon.doe@google.com");
+ clickInEditorAndWait(R.id.payments_edit_done_button, mReadyToPay);
+ clickAndWait(R.id.button_primary, mReadyForUnmaskInput);
+ setTextInCardUnmaskDialogAndWait(R.id.card_unmask_input, "123", mReadyToUnmask);
+ clickCardUnmaskButtonAndWait(DialogInterface.BUTTON_POSITIVE, mDismissed);
+ expectResultContains(new String[] {"555-555-5555", "jon.doe@google.com"});
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698