mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
149697359b
--HG-- rename : dom/power/test/browser_bug697132.js => dom/power/test/browser_wakelocks.js
66 lines
1.7 KiB
HTML
66 lines
1.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test Enabling/Disabling Screen with Power Management API</title>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
"use strict";
|
|
|
|
function testEnableScreen() {
|
|
try {
|
|
navigator.mozPower.screenEnabled = true;
|
|
ok(navigator.mozPower.screenEnabled === true, "Enabled screen.");
|
|
} catch (e) {
|
|
ok(false, "Unexpected exception trying to enable screen.");
|
|
}
|
|
}
|
|
|
|
function testDisableScreen() {
|
|
try {
|
|
navigator.mozPower.screenEnabled = false;
|
|
ok(navigator.mozPower.screenEnabled === false, "Disabled screen.");
|
|
} catch (e) {
|
|
ok(false, "Unexpected exception trying to disable screen.");
|
|
}
|
|
}
|
|
|
|
function startTests() {
|
|
|
|
// Make sure we don't suspend
|
|
navigator.mozPower.cpuSleepAllowed = false;
|
|
|
|
testDisableScreen();
|
|
testEnableScreen();
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.expectAssertions(0, 9);
|
|
SimpleTest.waitForExplicitFinish();
|
|
if (SpecialPowers.hasPermission("power", document)) {
|
|
// Currently only applicable on FxOS
|
|
if (navigator.userAgent.indexOf("Mobile") != -1 &&
|
|
navigator.appVersion.indexOf("Android") == -1) {
|
|
startTests();
|
|
} else {
|
|
ok(true, "mozPower on Firefox OS only.");
|
|
SimpleTest.finish();
|
|
}
|
|
} else {
|
|
// Add the permission and reload so it's propogated
|
|
SpecialPowers.addPermission("power", true, document);
|
|
window.location.reload();
|
|
}
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|