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

Unified Diff: chrome/test/data/android/payments/active_payment_query_bobpay.js

Issue 2524613004: [Merge M-56] Return cached query result for canMakeActivePayment. (Closed)
Patch Set: Created 4 years, 1 month 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/test/data/android/payments/active_payment_query_bobpay.js
diff --git a/chrome/test/data/android/payments/active_payment_query_bobpay.js b/chrome/test/data/android/payments/active_payment_query_bobpay.js
index a5b21b5ef376fa6f3e1317ae5569866aab997f68..0667e691512ffd18a8f8dff0f1f1c51aac645bfb 100644
--- a/chrome/test/data/android/payments/active_payment_query_bobpay.js
+++ b/chrome/test/data/android/payments/active_payment_query_bobpay.js
@@ -7,22 +7,87 @@
/* global PaymentRequest:false */
/* global print:false */
+var first;
+var second;
+
+/**
+ * Sets the |first| variable and prints both |first| and |second| only if both
+ * were set.
+ */
+function printFirst(result) {
+ first = result.toString();
+ if (first && second) {
+ print(first + ', ' + second);
+ }
+}
+
/**
- * Checks for existence of Bob Pay.
+ * Sets the |second| variable and prints both |first| and |second| only if both
+ * were set.
+ */
+function printSecond(result) {
+ second = result.toString();
+ if (first && second) {
+ print(first + ', ' + second);
+ }
+}
+
+/**
+ * Checks for existence of Bob Pay twice.
*/
function buy() { // eslint-disable-line no-unused-vars
+ first = null;
+ second = null;
+
+ try {
+ new PaymentRequest(
+ [{supportedMethods: ['https://bobpay.com']}],
+ {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}})
+ .canMakeActivePayment()
+ .then(function(result) { printFirst(result); })
+ .catch(function(error) { printFirst(error); });
+ } catch (error) {
+ printFirst(error);
+ }
+
try {
- var request = new PaymentRequest(
+ new PaymentRequest(
[{supportedMethods: ['https://bobpay.com']}],
- {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}});
- request.canMakeActivePayment()
- .then(function(result) {
- print(result);
- })
- .catch(function(error) {
- print(error);
- });
+ {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}})
+ .canMakeActivePayment()
+ .then(function(result) { printSecond(result); })
+ .catch(function(error) { printSecond(error); });
+ } catch (error) {
+ printSecond(error);
+ }
+}
+
+/**
+ * Checks for existence of Bob Pay and AlicePay.
+ */
+function otherBuy() { // eslint-disable-line no-unused-vars
+ first = null;
+ second = null;
+
+ try {
+ new PaymentRequest(
+ [{supportedMethods: ['https://bobpay.com']}],
+ {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}})
+ .canMakeActivePayment()
+ .then(function(result) { printFirst(result); })
+ .catch(function(error) { printFirst(error); });
+ } catch (error) {
+ printFirst(error);
+ }
+
+ try {
+ new PaymentRequest(
+ [{supportedMethods: ['https://alicepay.com']}],
+ {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}})
+ .canMakeActivePayment()
+ .then(function(result) { printSecond(result); })
+ .catch(function(error) { printSecond(error); });
} catch (error) {
- print(error.message);
+ printSecond(error);
}
}

Powered by Google App Engine
This is Rietveld 408576698