https://github.com/web-platform-tests/wpt
Raw File
Tip revision: b5fa1694c68e57cb2fb7de0647d1ebd359f0d1f4 authored by James Graham on 24 April 2014, 11:17:29 UTC
Wait for server to start when probing subdomains.
Tip revision: b5fa169
battery-interface-idlharness.html
<!DOCTYPE html>
<html>
  <head>
    <title>Battery Status API Test Suite</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 type="text/plain" class="untested">
    interface Navigator { };
    
    interface EventTarget {
      void addEventListener(DOMString type, EventListener? callback, optional boolean capture);
      void removeEventListener(DOMString type, EventListener? callback, optional boolean capture);
      boolean dispatchEvent(Event event);
    };
    
    [Callback]
    interface EventListener {
      void handleEvent(Event event);
    };
    </script>
    <script type="text/plain">
    partial interface Navigator {
        readonly attribute BatteryManager battery;
    };
    
    interface BatteryManager : EventTarget {
        readonly attribute boolean             charging;
        readonly attribute unrestricted double chargingTime;
        readonly attribute unrestricted double dischargingTime;
        readonly attribute double              level;
                 attribute EventHandler        onchargingchange;
                 attribute EventHandler        onchargingtimechange;
                 attribute EventHandler        ondischargingtimechange;
                 attribute EventHandler        onlevelchange;
    };
    </script>
    <script>
    "use strict";
    var idl_array = new IdlArray();
    var idls;
    [].forEach.call(document.querySelectorAll('script[type=text\\/plain]'), function(node) {
      // replace 'EventHandler' and 'unrestricted double' unrecognized by idlharness.js
      idls = node.textContent.replace('EventHandler', 'Function?', 'g').replace('unrestricted double', 'double', 'g');
      idl_array[(node.className === 'untested') ? 'add_untested_idls' : 'add_idls'](idls);
    });
    idl_array.add_objects({Navigator: ['navigator'], BatteryManager: ['navigator.battery']});
    idl_array.test();
    </script>
  </head>
  <body>
    <h1>Description</h1>
    <p>
      This test validates the BatteryManager interface IDL.
    </p>
    <p>
      This test uses <a href="/resources/idlharness.js">idlharness.js</a>, and
      is complementary to the <a href="battery-interface.html">battery-interface.html</a>
      test.
    </p>
    <div id="log"></div>
    <p>
      <small>
        Distributed under both the
        <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">
        W3C Test Suite License</a> and the
        <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">
        W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the
        <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution
        forms</a>.
      </small>
    </p>
  </body>
</html>


back to top