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 total_amount: {currency: 'USD', value: '55.00'}, | |
18 stringified_details: '{}' | 17 stringified_details: '{}' |
19 }; | 18 }; |
20 | 19 |
21 promise_test(t => { | 20 promise_test(t => { |
22 var mock; | 21 var mock; |
23 var completeResult; | 22 var completeResult; |
24 return paymentRequestMock | 23 return paymentRequestMock |
25 .then(m => { | 24 .then(m => { |
26 mock = m; | 25 mock = m; |
27 var result = new PaymentRequest([{'supportedMethods': ['visa']}], deta
ils).show(); | 26 var result = new PaymentRequest([{'supportedMethods': ['visa']}], deta
ils).show(); |
28 gc(); | 27 gc(); |
29 mock.onPaymentResponse(response_data); | 28 mock.onPaymentResponse(response_data); |
30 return result; | 29 return result; |
31 }) | 30 }) |
32 .then(response => { | 31 .then(response => { |
33 completeResult = response.complete("success"); | 32 completeResult = response.complete("success"); |
34 // Return before calling gc() to make sure reference to response | 33 // Return before calling gc() to make sure reference to response |
35 // is gone. | 34 // is gone. |
36 }) | 35 }) |
37 .then(() => { | 36 .then(() => { |
38 gc(); | 37 gc(); |
39 mock.onComplete(); | 38 mock.onComplete(); |
40 return completeResult; | 39 return completeResult; |
41 }); | 40 }); |
42 }, 'Promises resolve even without references to request or response.'); | 41 }, 'Promises resolve even without references to request or response.'); |
43 </script> | 42 </script> |
OLD | NEW |