https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 937e5a795fd890bf2d3925589ae87313b6500549 authored by Raymond Toy on 28 June 2018, 17:31:35 UTC
Enable analyser tests to run with Chrome
Tip revision: 937e5a7
battery-interface-idlharness.https.html
<!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>
back to top