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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java

Issue 1958793002: Test cancelling card unmasking dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@callback-tests
Patch Set: Address comments/ Created 4 years, 7 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/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
index 90f51ea3f4a3d7468be6a5457a43a8be3a4165d4..d5a30a806f1cd77355feb824ed6dd1f131f96eb4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestUI.java
@@ -125,6 +125,11 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
void onPaymentRequestReadyToClose(PaymentRequestUI ui);
/**
+ * Called when clicks on the PAY button are possible.
+ */
+ void onPaymentRequestReadyToPay(PaymentRequestUI ui);
+
+ /**
* Called when the UI is gone.
*/
void onPaymentRequestDismiss();
@@ -139,7 +144,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
/** Length of the animation to either show the UI or expand it to full height. */
private static final int DIALOG_ENTER_ANIMATION_MS = 225;
- private static PaymentRequestObserverForTest sObseverForTest;
+ private static PaymentRequestObserverForTest sObserverForTest;
private final Context mContext;
private final Client mClient;
@@ -200,8 +205,8 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
public static PaymentRequestUI show(Activity activity, Client client, boolean requestShipping,
String title, String origin) {
PaymentRequestUI ui = new PaymentRequestUI(activity, client, requestShipping, title, origin,
- sObseverForTest);
- sObseverForTest = null;
+ sObserverForTest);
+ sObserverForTest = null;
return ui;
}
@@ -504,6 +509,8 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mPayButton.setEnabled(mPaymentMethodSectionInformation != null
&& mPaymentMethodSectionInformation.getSelectedItem() != null);
}
+
+ notifyReadyToPay();
}
/** @return Whether or not the dialog can be closed via the X close button. */
@@ -656,6 +663,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mIsInitialLayoutComplete = true;
notifyReadyToClose();
notifyReadyForInput();
+ notifyReadyToPay();
}
}
@@ -732,6 +740,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
update(0.0f);
notifyReadyToClose();
notifyReadyForInput();
+ notifyReadyToPay();
}
});
mCurrentAnimator.start();
@@ -740,7 +749,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
@VisibleForTesting
public static void setObserverForTest(PaymentRequestObserverForTest observerForTest) {
- sObseverForTest = observerForTest;
+ sObserverForTest = observerForTest;
}
@VisibleForTesting
@@ -749,13 +758,19 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
}
private void notifyReadyForInput() {
- if (isAcceptingUserInput() && mObserverForTest != null) {
+ if (mObserverForTest != null && isAcceptingUserInput()) {
mObserverForTest.onPaymentRequestReadyForInput(this);
}
}
+ private void notifyReadyToPay() {
+ if (mObserverForTest != null && isAcceptingUserInput() && mPayButton.isEnabled()) {
+ mObserverForTest.onPaymentRequestReadyToPay(this);
+ }
+ }
+
private void notifyReadyToClose() {
- if (isAcceptingCloseButton() && mObserverForTest != null) {
+ if (mObserverForTest != null && isAcceptingCloseButton()) {
mObserverForTest.onPaymentRequestReadyToClose(this);
}
}

Powered by Google App Engine
This is Rietveld 408576698