Bug 846200 - Update mochitests to use new settings-api permissions; r=bent
authorKyle Machulis <kyle@nonpolynomial.com>
Wed, 27 Aug 2014 21:01:29 -0700
changeset 202318 565b3b3526a7d39716f71bb27f7ff48c398ca28e
parent 202317 c107147819ea9ef8dd53349805424a8da668044e
child 202319 3ecbe14009fbe0fbabc7a7f6cf0b41eeafe3f494
push id10168
push userkmachulis@mozilla.com
push dateFri, 29 Aug 2014 07:39:33 +0000
treeherderb2g-inbound@ab60d3c61f55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs846200
milestone34.0a1
Bug 846200 - Update mochitests to use new settings-api permissions; r=bent
dom/permission/tests/unit/test_bug808734.js
dom/settings/tests/test_settings_basics.html
dom/settings/tests/test_settings_blobs.html
dom/settings/tests/test_settings_data_uris.html
dom/settings/tests/test_settings_navigator_object.html
dom/settings/tests/test_settings_onsettingchange.html
dom/tests/mochitest/geolocation/test_mozsettings.html
dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
--- a/dom/permission/tests/unit/test_bug808734.js
+++ b/dom/permission/tests/unit/test_bug808734.js
@@ -10,16 +10,17 @@ var gData = [
   expected: ["contacts-read", "contacts-create",
              "contacts-write"]
 },
 // test additional expansion and access not having read+create+write
 {
   permission: "settings",
   access: READWRITE,
   expected: ["settings-read", "settings-write",
+             "settings-api-read", "settings-api-write",
              "indexedDB-chrome-settings-read",
              "indexedDB-chrome-settings-write"]
 },
 // test substitute
 {
   permission: "storage",
   expected: ["indexedDB-unlimited",
              "default-persistent-storage"]
--- a/dom/settings/tests/test_settings_basics.html
+++ b/dom/settings/tests/test_settings_basics.html
@@ -20,16 +20,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 }
 
+SpecialPowers.addPermission("settings-api-read", true, document);
+SpecialPowers.addPermission("settings-api-write", true, document);
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-write", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
--- a/dom/settings/tests/test_settings_blobs.html
+++ b/dom/settings/tests/test_settings_blobs.html
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 }
 
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-write", true, document);
+SpecialPowers.addPermission("settings-api-read", true, document);
+SpecialPowers.addPermission("settings-api-write", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_data_uris.html
+++ b/dom/settings/tests/test_settings_data_uris.html
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 }
 
 SpecialPowers.addPermission("settings-read", true, document);
 SpecialPowers.addPermission("settings-write", true, document);
+SpecialPowers.addPermission("settings-api-read", true, document);
+SpecialPowers.addPermission("settings-api-write", true, document);
 
 function onUnwantedSuccess() {
   ok(false, "onUnwantedSuccess: shouldn't get here");
 }
 
 function onFailure() {
   return function(s) {
     if (s) {
--- a/dom/settings/tests/test_settings_navigator_object.html
+++ b/dom/settings/tests/test_settings_navigator_object.html
@@ -27,17 +27,19 @@ function testPref() {
   }, function() {
     ise(navigator.mozSettings, undefined, "navigator.mozSettings is undefined");
     SimpleTest.finish();
   });
 }
 
 SpecialPowers.pushPermissions([
   {type: "settings-read", allow: 0, context: document},
-  {type: "settings-write", allow: 0, context: document}
+  {type: "settings-write", allow: 0, context: document},
+  {type: "settings-api-read", allow: 0, context: document},
+  {type: "settings-api-write", allow: 0, context: document}
 ], function() {
   ise(frames[0].navigator.mozSettings, null, "navigator.mozSettings is null when the page doesn't have permissions");
   testPref();
 });
 </script>
 </pre>
 </body>
 </html>
--- a/dom/settings/tests/test_settings_onsettingchange.html
+++ b/dom/settings/tests/test_settings_onsettingchange.html
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 "use strict";
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 }
 
 SpecialPowers.addPermission("settings-write", true, document);
 SpecialPowers.addPermission("settings-read", true, document);
+SpecialPowers.addPermission("settings-api-read", true, document);
+SpecialPowers.addPermission("settings-api-write", true, document);
 
 var screenBright = {"screen.brightness": 0.7};
 
 function onFailure() {
   ok(false, "in on Failure!");
 }
 
 function observer1(setting) {
--- a/dom/tests/mochitest/geolocation/test_mozsettings.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettings.html
@@ -26,17 +26,21 @@ resume_geolocationProvider(function() {
 });
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 }
 
 function test1() {
   //This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
-  SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document}, {'type': 'settings-write', 'allow': true, 'context': document}], test2);
+  SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
+                                 {'type': 'settings-write', 'allow': true, 'context': document},
+                                 {'type': 'settings-api-write', 'allow': true, 'context': document},
+                                 {'type': 'settings-api-read', 'allow': true, 'context': document}
+  ], test2);
 }
 
 function test2() {
   ok(navigator.geolocation, "get geolocation object");
 
   toggleGeolocationSetting(false, function() {
       ok(true, "turned off geolocation via mozSettings");
       setTimeout(function() {
--- a/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
+++ b/dom/tests/mochitest/geolocation/test_mozsettingsWatch.html
@@ -26,17 +26,21 @@ resume_geolocationProvider(function() {
 });
 
 if (SpecialPowers.isMainProcess()) {
   SpecialPowers.Cu.import("resource://gre/modules/SettingsChangeNotifier.jsm");
 }
 
 function test1() {
   //This pushPermissions call is after pushPrefEnv call and pushPrefEnv calls follow after this
-  SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document}, {'type': 'settings-write', 'allow': true, 'context': document}], test2);
+  SpecialPowers.pushPermissions([{'type': 'settings-read', 'allow': true, 'context': document},
+                                 {'type': 'settings-write', 'allow': true, 'context': document},
+                                 {'type': 'settings-api-write', 'allow': true, 'context': document},
+                                 {'type': 'settings-api-read', 'allow': true, 'context': document}
+  ], test2);
 }
 
 var watchId;
 function test2() {
   ok(navigator.geolocation, "get geolocation object");
 
   toggleGeolocationSetting(false, function() {
       ok(true, "turned off geolocation via mozSettings");