Bug 1286530 - Switch Feature-related mochitests to chrome draft
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Mon, 02 May 2016 14:55:28 +0200
changeset 387275 cff75ebcca092a0622e2ebcff4039579bb7fc724
parent 387274 01c502c72ec82598218e5f8c77fef07e414b4069
child 387276 cf7faaf8e16f9eecb905e7b93ed90a667859ec87
push id22914
push userbmo:lissyx+mozillians@lissyx.dyndns.org
push dateWed, 13 Jul 2016 15:39:24 +0000
bugs1286530
milestone50.0a1
Bug 1286530 - Switch Feature-related mochitests to chrome MozReview-Commit-ID: 5jgIsXVtHOL Conflicts: dom/base/test/mochitest.ini
dom/base/test/chrome.ini
dom/base/test/test_getFeature_with_perm.html
dom/base/test/test_getFeature_without_perm.html
dom/base/test/test_hasFeature.html
--- 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") },