tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

battery-charging-manual.https.html (1761B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Battery Test: battery neither empty or full, charger plugged in</title>
      4 <link rel="author" title="Intel" href="http://www.intel.com">
      5 <link rel="help" href="https://www.w3.org/TR/battery-status/">
      6 <meta name="flags" content="interact">
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 
     10 <h2>Description</h2>
     11 <p>
     12  This test validates that all of the BatteryManager attributes exist and are set to their correct values when battery is charging.
     13 </p>
     14 
     15 <h2>Preconditions</h2>
     16 <ol>
     17  <li>
     18    The device is plugged in to the charger before this test is run.
     19  </li>
     20  <li>
     21    The battery must neither be empty or full, nor reach empty or full capacity during the test.
     22  </li>
     23  <li>
     24    Waiting for battery level change to fire levelchange event, maybe need a long time
     25  </li>
     26 </ol>
     27 
     28 <script>
     29 
     30 setup({ explicit_timeout: true });
     31 
     32 async_test(function (t) {
     33  navigator.getBattery().then(function (battery) {
     34    t.step(function () {
     35      assert_true(battery.charging, 'charging must be set to true');
     36      assert_equals(battery.dischargingTime, Infinity, 'dischargingTime must be set to Infinity');
     37      assert_greater_than(battery.level, 0, 'level must be greater than 0');
     38      assert_less_than_equal(battery.level, 1.0, 'level must be less than or equal to 1.0');
     39 
     40      var battery_level = battery.level;
     41      battery.onlevelchange = t.step_func(function () {
     42        assert_greater_than(battery.level, battery_level, 'The value of the level attribute must increase');
     43        t.done();
     44      });
     45    });
     46  }, function (error) {
     47    t.step(function () {
     48      assert_unreached(error.message);
     49    });
     50    t.done();
     51  });
     52 }, document.title);
     53 
     54 </script>