https://github.com/web-platform-tests/wpt
Raw File
Tip revision: abe917f7bffefea2cadd1c3c501d50339f5c2d9c authored by Hallvord R. M. Steen on 12 October 2015, 12:04:22 UTC
Removing some 'popups must be enabled' messages
Tip revision: abe917f
battery-created.html
<!DOCTYPE html>
<html>
  <head>
    <title>Battery Status API Test Suite</title>
    <script src="/resources/testharness.js"></script>
    <link rel="stylesheet" href="/resources/testharness.css" media="all"/>
  </head>
  <body>
    <h1>Description</h1>
    <p>
      <strong>
        This test is only useful on devices that expose the BatteryManager interface,
        but lack a backend implementation.
      </strong>
    </p>
    <p>
      This test validates that all of the navigator.battery attributes exist and are set to their default values.
    </p>
    <h2>Preconditions</h2>
    <ol>
      <li>
        The implementation is unable to report the battery's charging state,
        charging time, level or remaining time respectively.
      </li>
      <li>
        The device is unplugged from the charger before this test case is run.
      </li>
    </ol>
    <div id="log"></div>
    <script>
    (function() {
      test(function() {
        var b = navigator.battery;
        assert_true(b.charging === true, 'charging must be set to true');
        assert_true(b.chargingTime === 0, 'chargingTime must be set to 0');
        assert_true(b.level === 1.0, 'level must be set to 1.0');
        assert_true(b.dischargingTime === Infinity, 'dischargingTime must be set to Infinity');

      }, 'When a BatteryManager object is created, charging must be set to true, ' +
      'chargingTime to 0, level to 1.0 and dischargingTime to the value positive ' +
      'Infinity, if the implementation is unable to report the battery\'s charging ' +
      'state, charging time, level or remaining time respectively.');
      })();
    </script>
  </body>
</html>
back to top