gecko-dev/testing/web-platform/tests/battery-status/battery-created-manual.html
James Graham 6e63d652c5 Bug 1146321 - Update web-platform-tests to revision 1defdd7213b52589e4b7a259e53f4fff359c301a, a=testonly
--HG--
rename : testing/web-platform/tests/battery-status/battery-full-manual.html => testing/web-platform/tests/FileAPI/FileReader/Progress_event_bubbles_cancelable.html
rename : testing/web-platform/tests/XMLHttpRequest/send-entity-body-none.htm => testing/web-platform/tests/XMLHttpRequest/open-during-abort.htm
rename : testing/web-platform/tests/DOMEvents/tests/approved/EventListener.dispatch.new.event.html => testing/web-platform/tests/dom/events/Event-dispatch-reenter.html
rename : testing/web-platform/tests/html/semantics/grouping-content/the-li-element/grouping-li-novalue-MANUAL.html => testing/web-platform/tests/html/semantics/grouping-content/the-li-element/grouping-li-novalue-manual.html
rename : testing/web-platform/tests/XMLHttpRequest/send-entity-body-none.htm => testing/web-platform/tests/html/semantics/interactive-elements/the-details-element/details.html
rename : testing/web-platform/tests/serve => testing/web-platform/tests/serve.py
rename : testing/web-platform/tests/webstorage/storage_builtins.js => testing/web-platform/tests/webstorage/builtins.html
rename : testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-for-onload.html => testing/web-platform/tests/webstorage/clear.html
rename : testing/web-platform/tests/battery-status/battery-promise.html => testing/web-platform/tests/webstorage/in.html
rename : testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-for-event.html => testing/web-platform/tests/webstorage/indexing.html
rename : testing/web-platform/tests/battery-status/battery-promise.html => testing/web-platform/tests/webstorage/length.html
rename : testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-for-event.html => testing/web-platform/tests/webstorage/removeitem.html
2015-03-23 13:21:13 +00:00

55 lines
1.7 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>Battery Test: no backend implementation, charger unplugged in</title>
<meta name="flags" content="interact">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<h2>Description</h2>
<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 BatteryManager 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>
async_test(function (t) {
navigator.getBattery().then(function (battery) {
t.step(function () {
assert_true(battery.charging, 'charging must be set to true');
assert_equals(battery.chargingTime, 0, 'chargingTime must be set to 0');
assert_equals(battery.dischargingTime, Infinity, 'dischargingTime must be set to Infinity');
assert_equals(battery.level, 1.0, 'level must be set to 1.0');
});
t.done();
}, function (error) {
t.step(function () {
assert_unreached(error.message);
});
t.done();
});
}, '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>