Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug 843893 - Fix alarm and power mochitests, r=gene.lian

  • Loading branch information...
commit 0117132e952cf25170318548e3d962265a411dcf 1 parent ab31a83
@dclarke dclarke authored
View
29 dom/alarm/test/test_alarm_non_permitted_app.html
@@ -14,21 +14,24 @@
"use strict";
SimpleTest.waitForExplicitFinish();
-
-SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
+if (SpecialPowers.hasPermission("alarms", document)) {
SpecialPowers.removePermission("alarms", document);
+ window.location.reload();
+} else {
+ SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() {
+ SpecialPowers.removePermission("alarms", document);
- // mozAlarms is intalled on all platforms except Android for the moment.
- if (navigator.appVersion.indexOf("Android") != -1) {
- ok(!('mozAlarms' in navigator), "navigator.mozAlarms should not exist");
- } else {
- ok('mozAlarms' in navigator, "navigator.mozAlarms should exist");
- is(navigator.mozAlarms, null, "navigator.mozAlarms should return null");
- }
-
- SimpleTest.finish();
-});
-
+ // mozAlarms is intalled on all platforms except Android for the moment.
+ if (navigator.appVersion.indexOf("Android") != -1) {
+ ok(!('mozAlarms' in navigator), "navigator.mozAlarms should not exist");
+ } else {
+ ok('mozAlarms' in navigator, "navigator.mozAlarms should exist");
+ is(navigator.mozAlarms, null, "navigator.mozAlarms should return null");
+ }
+ SpecialPowers.addPermission("alarms", true, document);
+ SimpleTest.finish();
+ });
+}
</script>
</pre>
</body>
View
1  dom/alarm/test/test_alarm_permitted_app.html
@@ -28,7 +28,6 @@
"navigator.mozAlarms should be an nsIDOMMozAlarmsManager object");
}
- SpecialPowers.removePermission("alarms", document);
SimpleTest.finish();
});
View
3  dom/power/moz.build
@@ -3,7 +3,8 @@
# 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/.
-TEST_DIRS += ['test']
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+ TEST_DIRS += ['test']
XPIDL_SOURCES += [
'nsIDOMPowerManager.idl',
View
10 dom/power/test/test_power_basics.html
@@ -19,24 +19,24 @@
function startTest() {
window.frames[0].frameElement.setAttribute('onload', 'doTest2()');
power = window.frames[0].navigator.mozPower;
- ok(!power, "Shouldn't be able to access power manager without permission.");
+ ok(power, "Should be able to access power manager with permission.");
- SpecialPowers.addPermission("power", true, window.frames[0].document);
+ SpecialPowers.removePermission("power", window.frames[0].document);
window.frames[0].location.reload();
}
function doTest2() {
window.frames[0].frameElement.setAttribute('onload', 'doTest3()');
power = window.frames[0].navigator.mozPower;
- ok(power, "Should be able to access power manager with permission.");
+ ok(!power, "Shouldn't be able to access power manager with permission.");
- SpecialPowers.removePermission("power", window.frames[0].document);
+ SpecialPowers.addPermission("power",true, window.frames[0].document);
window.frames[0].location.reload();
}
function doTest3() {
power = window.frames[0].navigator.mozPower;
- ok(!power, "Shouldn't be able to access power manager without permission.");
+ ok(power, "Should be able to access power manager with permission.");
SimpleTest.finish();
}
</script>
View
2  testing/mochitest/b2g.json
@@ -21,8 +21,6 @@
"content/base/test/test_CSP_evalscript.html":"",
"content/base/test/test_CSP_frameancestors.html":"",
"content/base/test/test_CSP_inlinescript.html":"",
- "dom/alarm/test/test_alarm_non_permitted_app.html":"",
- "dom/power/test/test_power_basics.html":"",
"content/svg/content/test/test_text_selection.html":"",
"content/base/test/test_CSP.html" : "",
"content/base/test/test_CrossSiteXHR_origin.html" : "",
Please sign in to comment.
Something went wrong with that request. Please try again.