| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>Battery test: IDL</title> |
| <link rel="author" title="Intel" href="http://www.intel.com"> |
| <link rel="help" href="https://www.w3.org/TR/battery-status/"> |
| <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> |
| "use strict"; |
| |
| promise_test(async () => { |
| const idl_array = new IdlArray(); |
| const dom_idl = await fetch("/interfaces/dom.idl").then(r => r.text()); |
| const battery_idl = await fetch("/interfaces/battery.idl").then(r => r.text()); |
| const manager = await navigator.getBattery(); |
| |
| idl_array.add_untested_idls(dom_idl, {only: ['EventTarget']}); |
| idl_array.add_untested_idls('interface EventHandler {};'); |
| idl_array.add_untested_idls('interface Navigator {};'); |
| idl_array.add_idls(battery_idl); |
| |
| window.manager = manager; |
| |
| idl_array.add_objects({ |
| Navigator: ['navigator'], |
| BatteryManager: ['manager'], |
| }); |
| idl_array.test(); |
| }, "Test IDL implementation of Battery Status API"); |
| </script> |