Bug 963366 - Re-enable basic power & wakelock tests for desktop. r=jmaher
☠☠ backed out by 59af72902abf ☠ ☠
author"Kan-Ru Chen (陳侃如)" <kanru@kanru.info>
Tue, 11 Feb 2014 13:57:24 +0800
changeset 168102 b183597c0190a289043be7309bc3f85cdf764d96
parent 168101 0af4a28621f7769d9f3f3017771edc20dc9a8aeb
child 168103 e0632c6aca0bbd0a38a17bb5c415981317f1f767
push id26197
push userryanvm@gmail.com
push dateTue, 11 Feb 2014 19:57:30 +0000
treeherdermozilla-central@802d87c77e76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs963366
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 963366 - Re-enable basic power & wakelock tests for desktop. r=jmaher --- dom/power/moz.build | 3 +-- dom/power/test/mochitest.ini | 3 +++ dom/power/test/test_power_basics.html | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-)
dom/power/moz.build
dom/power/test/mochitest.ini
dom/power/test/test_power_basics.html
--- a/dom/power/moz.build
+++ b/dom/power/moz.build
@@ -1,16 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # 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',
     'nsIPowerManagerService.idl',
 ]
 
 XPIDL_MODULE = 'dom_power'
 
--- a/dom/power/test/mochitest.ini
+++ b/dom/power/test/mochitest.ini
@@ -1,10 +1,13 @@
 [DEFAULT]
 
 [test_bug957893.html]
 [test_bug957899.html]
 [test_wakelock_not_exposed.html]
 skip-if = toolkit == "gonk"
 [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"
--- a/dom/power/test/test_power_basics.html
+++ b/dom/power/test/test_power_basics.html
@@ -3,25 +3,29 @@
 <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"/>
 <script type="application/javascript">
 
 /** 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
 
 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.");
 
   SpecialPowers.removePermission("power", window.frames[0].document);
   window.frames[0].location.reload();
 }