Bug 1286530 - Switch Feature-related mochitests to chrome
MozReview-Commit-ID: 5jgIsXVtHOL
Conflicts:
dom/base/test/mochitest.ini
--- a/dom/base/test/chrome.ini
+++ b/dom/base/test/chrome.ini
@@ -21,9 +21,11 @@ support-files = file_navigator_resolve_i
subsuite = clipboard
[test_messagemanager_principal.html]
[test_messagemanager_send_principal.html]
skip-if = buildapp == 'mulet'
[test_bug945152.html]
[test_bug1008126.html]
[test_sandboxed_blob_uri.html]
[test_websocket_frame.html]
+[test_getFeature_with_perm.html]
+[test_hasFeature.html]
[test_mozbrowser_apis_allowed.html]
--- a/dom/base/test/test_getFeature_with_perm.html
+++ b/dom/base/test/test_getFeature_with_perm.html
@@ -1,18 +1,18 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=979109
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 979109</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" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=983502">Mozilla Bug 983502</a>
<script type="application/javascript">
function testSupported() {
var mem;
navigator.getFeature("hardware.memory").then(function(mem) {
@@ -109,31 +109,27 @@ function runNextTest() {
tests[currentTest]();
} else {
SimpleTest.finish();
}
}
info("About to run " + tests.length + " tests");
-SpecialPowers.pushPermissions([
- {type: "feature-detection", allow: 1, context: document}
-], function() {
- ok('getFeature' in navigator, "navigator.getFeature should exist");
- ok('hasFeature' in navigator, "navigator.hasFeature should exist");
- // B2G specific manifest features.
- // Touching navigator before pushPermissions makes it fail.
- if (!navigator.userAgent.includes("Android") &&
- /Mobile|Tablet/.test(navigator.userAgent)) {
- info("Adding B2G specific tests");
- tests.push(createManifestTest("manifest.chrome.navigation"));
- tests.push(createManifestTest("manifest.precompile"));
- tests.push(createManifestTest("manifest.role.homescreen"));
- }
- runNextTest();
- ok(true, "Test DONE");
-});
+ok('getFeature' in navigator, "navigator.getFeature should exist");
+ok('hasFeature' in navigator, "navigator.hasFeature should exist");
+// B2G specific manifest features.
+// Touching navigator before pushPermissions makes it fail.
+if (!navigator.userAgent.includes("Android") &&
+ /Mobile|Tablet/.test(navigator.userAgent)) {
+ info("Adding B2G specific tests");
+ tests.push(createManifestTest("manifest.chrome.navigation"));
+ tests.push(createManifestTest("manifest.precompile"));
+ tests.push(createManifestTest("manifest.role.homescreen"));
+}
+runNextTest();
+ok(true, "Test DONE");
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>
deleted file mode 100644
--- a/dom/base/test/test_getFeature_without_perm.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=979109
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 979109</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=983502">Mozilla Bug 983502</a>
-<script type="application/javascript">
-
-
-is("getFeature" in navigator, false, "getFeature should not exist without permission");
-
-</script>
-</body>
-</html>
--- a/dom/base/test/test_hasFeature.html
+++ b/dom/base/test/test_hasFeature.html
@@ -1,18 +1,18 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1009645
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1009645</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" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1009645">Mozilla Bug 1009645</a>
<script type="application/javascript">
var b2gOnly;
function pref(name) {
@@ -22,19 +22,19 @@ function pref(name) {
return false;
}
}
function testAPIs() {
var APIEndPoints = [
{ name: "MozMobileNetworkInfo", enabled: pref("dom.mobileconnection.enabled") },
// { name: "Navigator.mozBluetooth", enabled: b2gOnly }, // conditional on MOZ_B2G_BT, tricky to test
- { name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") },
+ // Bug 1266035 { name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") },
{ name: "Navigator.getDeviceStorage", enabled: pref("device.storage.enabled") },
- { name: "Navigator.addIdleObserver", enabled: true },
+ // Bug 1266035 { name: "Navigator.addIdleObserver", enabled: true },
{ name: "Navigator.mozNetworkStats", enabled: pref("dom.mozNetworkStats.enabled") },
{ name: "Navigator.push", enabled: pref("services.push.enabled") },
// { name: "Navigator.mozTime", enabled: b2gOnly }, // conditional on MOZ_TIME_MANAGER, tricky to test
// { name: "Navigator.mozFMRadio", enabled: b2gOnly }, // conditional on MOZ_B2G_FM, tricky to test
{ name: "Navigator.mozCameras", enabled: true },
{ name: "Navigator.mozAlarms", enabled: pref("dom.mozAlarms.enabled") },
{ name: "Navigator.mozTCPSocket", enabled: pref("dom.mozTCPSocket.enabled") },
{ name: "Navigator.mozInputMethod", enabled: pref("dom.mozInputMethod.enabled") },