Reland "Replace Chrome IPC with Mojo IPC for querying BatteryStatus service"
[chromium-blink-merge.git] / content / test / data / battery_status / battery_status_promise_resolution_test.html
bloba83c54825cb1b8bf1190549920aa831e5c8455cf
1 <html>
2 <head>
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 &&
10 battery.level == 0.5;
13 function testBattery() {
14 navigator.getBattery().then(
15 function(battery) {
16 if (checkBatteryInfo(battery))
17 pass();
18 else
19 fail();
20 }, fail());
23 function pass() {
24 document.getElementById('status').innerHTML = 'PASS';
25 document.location = '#pass';
28 function fail() {
29 document.location = '#fail';
31 </script>
32 </head>
33 <body onLoad="testBattery()">
34 <div id="status">FAIL</div>
35 </body>
36 </html>