3 <title>Battery Status API test : promise resolution
</title>
4 <script type=
"text/javascript">
6 function checkBatteryInfo(battery
) {
7 return battery
.charging
&&
8 battery
.chargingTime
== 100 &&
9 battery
.dischargingTime
== Infinity
&&
13 function testBattery() {
14 navigator
.getBattery().then(
16 if (checkBatteryInfo(battery
))
24 document
.getElementById('status').innerHTML
= 'PASS';
25 document
.location
= '#pass';
29 document
.location
= '#fail';
33 <body onLoad=
"testBattery()">
34 <div id=
"status">FAIL
</div>