forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 911242 - [LED] De-couple the control of screen backlight and keyb…
…oard backlight. r=dhylands, sr=sicking
- Loading branch information
Showing
11 changed files
with
237 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!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 testEnableKeyLight() { | ||
try { | ||
navigator.mozPower.keyLightEnabled = true; | ||
ok(navigator.mozPower.keyLightEnabled === true, "Enabled key backlight."); | ||
} catch (e) { | ||
ok(false, "Unexpected exception trying to enable key backlight."); | ||
} | ||
} | ||
|
||
function testDisableKeyLight() { | ||
try { | ||
navigator.mozPower.keyLightEnabled = false; | ||
ok(navigator.mozPower.keyLightEnabled === false, "Disabled key backlight."); | ||
} catch (e) { | ||
ok(false, "Unexpected exception trying to disable key backlight."); | ||
} | ||
} | ||
|
||
function startTests() { | ||
|
||
// Make sure we don't suspend | ||
navigator.mozPower.cpuSleepAllowed = false; | ||
|
||
testDisableKeyLight(); | ||
testEnableKeyLight(); | ||
|
||
SimpleTest.finish(); | ||
} | ||
|
||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.