| <!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> | |