| <!doctype html> |
| <meta charset=utf-8> |
| <title>Payment Request interface IDL tests</title> |
| <script src=/resources/testharness.js></script> |
| <script src=/resources/testharnessreport.js></script> |
| <script src=/resources/WebIDLParser.js></script> |
| <script src=/resources/idlharness.js></script> |
| <script> |
| promise_test(async () => { |
| const idlURLs = ["/interfaces/dom.idl", "/interfaces/payment-request.idl"]; |
| const idlArray = new IdlArray(); |
| for(const url of idlURLs){ |
| const idlText = await fetch(url).then(r => r.text()); |
| idlArray.add_idls(idlText); |
| } |
| // typedef EventHandler from HTML |
| // https://html.spec.whatwg.org/#eventhandler |
| idlArray.add_idls(` |
| [TreatNonObjectAsNull] |
| callback EventHandlerNonNull = any (Event event); |
| typedef EventHandlerNonNull? EventHandler; |
| `); |
| const methods = "[{supportedMethods: 'foo'}]"; |
| const amount = "{currency: 'USD', value: '0'}"; |
| const details = `{total: {label: 'bar', amount: ${amount}} }`; |
| idlArray.add_objects({ |
| PaymentRequest: [`new PaymentRequest(${methods}, ${details})`], |
| }); |
| idlArray.test(); |
| }, "Setup for Payment Request API IDL tests."); |
| </script> |