OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <script src="../resources/mojo-helpers.js"></script> | 4 <script src="../resources/mojo-helpers.js"></script> |
5 <script src="resources/payment-request-mock.js"></script> | 5 <script src="resources/payment-request-mock.js"></script> |
6 <script> | 6 <script> |
7 var details = { | 7 var details = { |
8 total: | 8 total: |
9 { | 9 { |
10 label: 'Total', | 10 label: 'Total', |
11 amount: {currency: 'USD', value: '55.00'}, // US$55.00 | 11 amount: {currency: 'USD', value: '55.00'}, // US$55.00 |
12 } | 12 } |
13 }; | 13 }; |
14 | 14 |
15 var response_data = { | 15 var response_data = { |
16 method_name: 'visa', | 16 method_name: 'visa', |
17 stringified_details: '{}' | 17 stringified_details: '{}' |
18 }; | 18 }; |
19 | 19 |
20 promise_test(t => { | 20 promise_test(t => { |
21 var mock; | 21 var mock; |
22 var completeResult; | 22 var completeResult; |
23 return paymentRequestMock | 23 return paymentRequestMock |
24 .then(m => { | 24 .then(m => { |
25 mock = m; | 25 mock = m; |
26 var result = new PaymentRequest(['visa'], details).show(); | 26 var result = new PaymentRequest([{'supportedMethods': ['visa']}], deta
ils).show(); |
27 gc(); | 27 gc(); |
28 mock.onPaymentResponse(response_data); | 28 mock.onPaymentResponse(response_data); |
29 return result; | 29 return result; |
30 }) | 30 }) |
31 .then(response => { | 31 .then(response => { |
32 completeResult = response.complete(true); | 32 completeResult = response.complete(true); |
33 // Return before calling gc() to make sure reference to response | 33 // Return before calling gc() to make sure reference to response |
34 // is gone. | 34 // is gone. |
35 }) | 35 }) |
36 .then(() => { | 36 .then(() => { |
37 gc(); | 37 gc(); |
38 mock.onComplete(); | 38 mock.onComplete(); |
39 return completeResult; | 39 return completeResult; |
40 }); | 40 }); |
41 }, 'Promises resolve even without references to request or response.'); | 41 }, 'Promises resolve even without references to request or response.'); |
42 </script> | 42 </script> |
OLD | NEW |