blob: 2e2910cda60b79e1577f3976589422193d7b8c6b [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>Battery Test: navigator.getBattery() returns BatteryManager as a promise</title>
<link rel="author" title="YuichiNukiyama" href="https://github.com/YuichiNukiyama">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function returnBattery() {
return navigator.getBattery();
}
promise_test(function () {
return returnBattery()
.then(function (result) {
assert_class_string(result, "BatteryManager", "getBattery should return BatteryManager Object.");
});
}, "navigator.getBattery() return BatteryManager");
test(function () {
assert_equals(navigator.getBattery(), navigator.getBattery());
}, "navigator.getBattery() shall always return the same promise");
</script>
<div id="log"></div>