| 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);
|
| }
|
| }
|
|
|