mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-04 16:15:25 +00:00
35 lines
1.1 KiB
HTML
35 lines
1.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for Battery API</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Battery API **/
|
|
|
|
// Testing prefixing.
|
|
ok(!("NavigatorBattery" in window), "NavigatorBattery shouldn't be visible");
|
|
ok(("MozNavigatorBattery" in window), "MozNavigatorBattery should be visible");
|
|
ok(!("BatteryManager" in window), "BatteryManager shouldn't be visible");
|
|
ok(("MozBatteryManager" in window), "MozBatteryManager should be visible");
|
|
|
|
ok('mozBattery' in navigator, "navigator.mozBattery should exist");
|
|
|
|
var battery = navigator.mozBattery;
|
|
is(battery.level, 1.0, "Default battery level should be 1.0");
|
|
is(battery.charging, true, "Default charging value should be true");
|
|
is(battery.dischargingTime, Infinity, "Default dischargingTime should be Inifinity");
|
|
is(battery.chargingTime, 0, "Default chargingTime should be 0");
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|