gecko/dom/power/test/test_power_basics.html
2012-08-11 19:40:43 +08:00

35 lines
835 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for Power 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 Power API **/
ok('mozPower' in navigator, "navigator.mozPower should exist");
/** Test permission **/
SpecialPowers.removePermission("power", document);
power = navigator.mozPower;
ok(!power, "Shouldn't be able to access power manager without permission.");
SpecialPowers.addPermission("power", true, document);
power = navigator.mozPower;
ok(power, "Shouldn be able to access power manager with permission.");
</script>
</pre>
</body>
</html>