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

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

Issue 2081533002: Edit contacts UI for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contactDetails
Patch Set: 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/PaymentRequestTestBase.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java
index 373f8ea9051fbb562dcce998dc322e467421591a..e811ae63b44385688eeb562b1aefd079f6f8d47a 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java
@@ -38,7 +38,14 @@ import java.util.concurrent.atomic.AtomicReference;
abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeActivity>
implements PaymentRequestObserverForTest, PaymentRequestServiceObserverForTest,
CardUnmaskObserverForTest {
+ protected static final int CONSTRAINT_NONE = 0;
+ protected static final int CONSTRAINT_CONTACT_DETAILS = 1;
+ protected static final int CONSTRAINT_EDIT_DIALOG = 2;
+
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyForInput;
+ protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToEdit;
+ protected final PaymentsCallbackHelper<PaymentRequestUI> mEditorValidationError;
+ protected final PaymentsCallbackHelper<PaymentRequestUI> mEditorDismissed;
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToPay;
protected final PaymentsCallbackHelper<PaymentRequestUI> mReadyToClose;
protected final PaymentsCallbackHelper<PaymentRequestUI> mResultReady;
@@ -54,6 +61,9 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
protected PaymentRequestTestBase(String testFileName) {
super(ChromeActivity.class);
mReadyForInput = new PaymentsCallbackHelper<>();
+ mReadyToEdit = new PaymentsCallbackHelper<>();
+ mEditorValidationError = new PaymentsCallbackHelper<>();
+ mEditorDismissed = new PaymentsCallbackHelper<>();
mReadyToPay = new PaymentsCallbackHelper<>();
mReadyToClose = new PaymentsCallbackHelper<>();
mResultReady = new PaymentsCallbackHelper<>();
@@ -101,16 +111,37 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
protected void clickAndWait(final int resourceId, CallbackHelper helper)
throws InterruptedException, TimeoutException {
+ clickAndWait(CONSTRAINT_NONE, resourceId, helper);
+ }
+
+ protected void clickAndWait(final int constraint, final int resourceId, CallbackHelper helper)
+ throws InterruptedException, TimeoutException {
int callCount = helper.getCallCount();
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
- mUI.getDialogForTest().findViewById(resourceId).performClick();
+ if (constraint == CONSTRAINT_CONTACT_DETAILS) {
+ mUI.getContactDetailsSectionForTest().findViewById(resourceId).performClick();
+ } else if (constraint == CONSTRAINT_EDIT_DIALOG) {
+ mUI.getEditDialogForTest().findViewById(resourceId).performClick();
+ } else {
+ mUI.getDialogForTest().findViewById(resourceId).performClick();
+ }
}
});
helper.waitForCallback(callCount);
}
+ protected void typeInEditDialog(final int resourceId, final String input)
gone 2016/06/21 06:04:39 I'd rename this something else because it's direct
please use gerrit instead 2016/06/22 02:12:31 Done.
+ throws InterruptedException, TimeoutException {
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() {
+ @Override
+ public void run() {
+ ((EditText) mUI.getEditDialogForTest().findViewById(resourceId)).setText(input);
+ }
+ });
+ }
+
protected String getAddressSectionLabel() throws ExecutionException {
return ThreadUtils.runOnUiThreadBlocking(new Callable<String>() {
@Override
@@ -183,6 +214,24 @@ abstract class PaymentRequestTestBase extends ChromeActivityTestCaseBase<ChromeA
}
@Override
+ public void onPaymentRequestReadyToEdit(PaymentRequestUI ui) {
+ ThreadUtils.assertOnUiThread();
+ mReadyToEdit.notifyCalled(ui);
+ }
+
+ @Override
+ public void onPaymentRequestEditorValidationError(PaymentRequestUI ui) {
+ ThreadUtils.assertOnUiThread();
+ mEditorValidationError.notifyCalled(ui);
+ }
+
+ @Override
+ public void onPaymentRequestEditorDismissed(PaymentRequestUI ui) {
+ ThreadUtils.assertOnUiThread();
+ mEditorDismissed.notifyCalled(ui);
+ }
+
+ @Override
public void onPaymentRequestReadyToPay(PaymentRequestUI ui) {
ThreadUtils.assertOnUiThread();
mReadyToPay.notifyCalled(ui);

Powered by Google App Engine
This is Rietveld 408576698