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

Side by Side Diff: chrome/test/data/android/payments/free_shipping.js

Issue 2579373002: [Payments] Add integration tests for auto advance in card editor (Closed)
Patch Set: address comments Created 4 years 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 unified diff | Download patch
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The Chromium Authors. All rights reserved. 2 * Copyright 2016 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* global PaymentRequest:false */ 7 /* global PaymentRequest:false */
8 /* global toDictionary:false */ 8 /* global toDictionary:false */
9 /* global print:false */ 9 /* global print:false */
10 10
11 /** 11 /**
12 * Launches the PaymentRequest UI that offers free shipping worldwide. 12 * Launches the PaymentRequest UI that offers free shipping worldwide.
13 */ 13 */
14 function buy() { // eslint-disable-line no-unused-vars 14 function buy() { // eslint-disable-line no-unused-vars
15 try { 15 try {
16 var details = { 16 var details = {
17 total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}, 17 total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}},
18 shippingOptions: [{ 18 shippingOptions: [{
19 id: 'freeShippingOption', 19 id: 'freeShippingOption',
20 label: 'Free global shipping', 20 label: 'Free global shipping',
21 amount: {currency: 'USD', value: '0'}, 21 amount: {currency: 'USD', value: '0'},
22 selected: true 22 selected: true
23 }] 23 }]
24 }; 24 };
25 var request = new PaymentRequest( 25 var request = new PaymentRequest(
26 [{supportedMethods: ['visa']}], details, 26 [{supportedMethods: ['visa', 'unionpay', 'mir', 'mastercard',
27 'jcb', 'discover', 'diners', 'amex']}],
28 details,
27 {requestShipping: true}); 29 {requestShipping: true});
28 request.addEventListener('shippingaddresschange', function(e) { 30 request.addEventListener('shippingaddresschange', function(e) {
29 e.updateWith(new Promise(function(resolve) { 31 e.updateWith(new Promise(function(resolve) {
30 // No changes in price based on shipping address change. 32 // No changes in price based on shipping address change.
31 resolve(details); 33 resolve(details);
32 })); 34 }));
33 }); 35 });
34 request.show() 36 request.show()
35 .then(function(resp) { 37 .then(function(resp) {
36 resp.complete('success') 38 resp.complete('success')
37 .then(function() { 39 .then(function() {
38 print( 40 print(
39 resp.shippingOption + '<br>' + 41 resp.shippingOption + '<br>' +
40 JSON.stringify( 42 JSON.stringify(
41 toDictionary(resp.shippingAddress), undefined, 2) + 43 toDictionary(resp.shippingAddress), undefined, 2) +
42 '<br>' + resp.methodName + '<br>' + 44 '<br>' + resp.methodName + '<br>' +
43 JSON.stringify(resp.details, undefined, 2)); 45 JSON.stringify(resp.details, undefined, 2));
44 }) 46 })
45 .catch(function(error) { 47 .catch(function(error) {
46 print(error); 48 print(error);
47 }); 49 });
48 }) 50 })
49 .catch(function(error) { 51 .catch(function(error) {
50 print(error); 52 print(error);
51 }); 53 });
52 } catch (error) { 54 } catch (error) {
53 print(error.message); 55 print(error.message);
54 } 56 }
55 } 57 }
OLDNEW
« no previous file with comments | « chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestTestBase.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698