Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <!-- Copyright © 2017 Chromium authors and World Wide Web Consortium, (Massachus etts Institute of Technology, ERCIM, Keio University, Beihang). --> | |
| 3 <meta charset="utf-8"> | |
| 4 <title>Test for PaymentRequest Constructor</title> | |
|
Marijn Kruisselbrink
2017/05/05 17:53:19
copy/past error?
please use gerrit instead
2017/05/05 18:16:33
Done.
| |
| 5 <link rel="help" href="https://w3c.github.io/browser-payment-api/#show-method"> | |
| 6 <script src="/resources/testharness.js"></script> | |
| 7 <script src="/resources/testharnessreport.js"></script> | |
| 8 <script> | |
| 9 'use strict'; | |
| 10 | |
| 11 async_test(t => { | |
| 12 const request1 = new PaymentRequest([{ | |
| 13 supportedMethods: ['basic-card'], | |
| 14 }], { | |
| 15 total: { | |
| 16 label: 'request1', | |
| 17 amount: { | |
| 18 currency: 'USD', | |
| 19 value: '1.00', | |
| 20 }, | |
| 21 }, | |
| 22 }); | |
| 23 const request2 = new PaymentRequest([{ | |
| 24 supportedMethods: ['basic-card'], | |
| 25 }], { | |
| 26 total: { | |
| 27 label: 'request2', | |
| 28 amount: { | |
| 29 currency: 'USD', | |
| 30 value: '1.00', | |
| 31 }, | |
| 32 }, | |
| 33 }); | |
| 34 request1.show().catch(t.step_func_done()); | |
| 35 request2.show().catch(t.step_func(e => { | |
|
Marijn Kruisselbrink
2017/05/05 17:53:19
you could rewrite this part as:
promise_rejects(t,
please use gerrit instead
2017/05/05 18:16:33
Done.
| |
| 36 assert_equals(Object.prototype.toString.call(e), '[object DOMException]'); | |
| 37 assert_equals(e.name, 'AbortError'); | |
| 38 request1.abort(); | |
| 39 })); | |
| 40 }, 'If the user agent\'s "payment request is showing" boolean is true, ' + | |
| 41 'then return a promise rejected with an "AbortError" DOMException.'); | |
| 42 </script> | |
| OLD | NEW |