Bug 963366 - Re-enable basic power & wakelock tests for desktop. r=jmaher

This commit is contained in:
"Kan-Ru Chen (陳侃如)" 2014-02-12 13:36:24 +08:00
parent 804bb1a165
commit 14bd4f69ec
3 changed files with 10 additions and 4 deletions

View File

@ -4,8 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
TEST_DIRS += ['test']
TEST_DIRS += ['test']
XPIDL_SOURCES += [
'nsIDOMWakeLockListener.idl',

View File

@ -6,5 +6,8 @@
run-if = appname != "b2g"
[test_power_basics.html]
[test_power_set_cpusleepallowed.html]
skip-if = toolkit != "gonk"
[test_power_set_screen_brightness.html]
skip-if = toolkit != "gonk"
[test_power_set_screen_enabled.html]
skip-if = toolkit != "gonk"

View File

@ -8,8 +8,6 @@
/** Test for Power API **/
ok('mozPower' in navigator, "navigator.mozPower should exist");
/** Test permission **/
// In b2g, addPermission 'power' is only working after a document reload
// See bug 802312
@ -17,6 +15,12 @@ ok('mozPower' in navigator, "navigator.mozPower should exist");
SimpleTest.waitForExplicitFinish();
function startTest() {
SpecialPowers.pushPermissions([
{type: "power", allow: true, context: window.frames[0].document}
], doTest1);
}
function doTest1() {
window.frames[0].frameElement.setAttribute('onload', 'doTest2()');
power = window.frames[0].navigator.mozPower;
ok(power, "Should be able to access power manager with permission.");