marionette tests fixes - Bug 1315506 - Remove app.update.url.override preference. r=mhowell
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 11 Nov 2016 12:58:36 -0800
changeset 348989 b333ba0fdd87463f9cc8bece66faf1c22c4c0716
parent 348988 00132770eecba298426f1f8fad715e1f92738f94
child 348990 993e106e331fc0a212e2c98837c21d35d6cb6614
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1315506
milestone52.0a1
marionette tests fixes - Bug 1315506 - Remove app.update.url.override preference. r=mhowell
testing/marionette/harness/marionette/atoms/b2g_update_test.js
toolkit/mozapps/update/tests/marionette/update_test_status.js
--- a/testing/marionette/harness/marionette/atoms/b2g_update_test.js
+++ b/testing/marionette/harness/marionette/atoms/b2g_update_test.js
@@ -102,16 +102,30 @@ function setPref(pref, value) {
       Services.prefs.setIntPref(pref, value);
       break;
     case "boolean":
       Services.prefs.setBoolPref(pref, value);
       break;
   }
 }
 
+function setDefaultPref(pref, value) {
+  switch (typeof(value)) {
+    case "string":
+      Services.prefs.getDefaultBranch(null).setCharPref(pref, value);
+      break;
+    case "number":
+      Services.prefs.getDefaultBranch(null).setIntPref(pref, value);
+      break;
+    case "boolean":
+      Services.prefs.getDefaultBranch(null).setBoolPref(pref, value);
+      break;
+  }
+}
+
 function getPrefTypeDefaultValue(prefType) {
   switch (prefType) {
     case "string":
       return null;
     case "number":
       return 0;
     case "boolean":
       return false;
--- a/toolkit/mozapps/update/tests/marionette/update_test_status.js
+++ b/toolkit/mozapps/update/tests/marionette/update_test_status.js
@@ -23,36 +23,36 @@ function forceCheckAndTestStatus(status,
     next();
   });
 
   sendContentEvent("force-update-check");
   forceSent = true;
 }
 
 function testBadXml() {
-  setPref("app.update.url.override", TEST_URL + "/bad.xml");
+  setDefaultPref("app.update.url", TEST_URL + "/bad.xml");
   forceCheckAndTestStatus("check-error-http-200", testAccessDenied);
 }
 
 function testAccessDenied() {
-  setPref("app.update.url.override", TEST_URL + "/cgi-bin/err.cgi?403");
+  setDefaultPref("app.update.url", TEST_URL + "/cgi-bin/err.cgi?403");
   forceCheckAndTestStatus("check-error-http-403", testNoUpdateXml);
 }
 
 function testNoUpdateXml() {
-  setPref("app.update.url.override", TEST_URL + "/none.html");
+  setDefaultPref("app.update.url", TEST_URL + "/none.html");
   forceCheckAndTestStatus("check-error-http-404", testInternalServerError);
 }
 
 function testInternalServerError() {
-  setPref("app.update.url.override", TEST_URL + "/cgi-bin/err.cgi?500");
+  setDefaultPref("app.update.url", TEST_URL + "/cgi-bin/err.cgi?500");
   forceCheckAndTestStatus("check-error-http-500", testBadHostStatus);
 }
 
 function testBadHostStatus() {
-  setPref("app.update.url.override", "http://bad-host-doesnt-exist-sorry.com");
+  setDefaultPref("app.update.url", "http://bad-host-doesnt-exist-sorry.com");
   forceCheckAndTestStatus("check-error-" + Cr.NS_ERROR_UNKNOWN_HOST, cleanUp);
 }
 
 // Update test functions
 function preUpdate() {
   testBadXml();
 }