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 322296 b333ba0fdd87463f9cc8bece66faf1c22c4c0716
parent 322295 00132770eecba298426f1f8fad715e1f92738f94
child 322297 993e106e331fc0a212e2c98837c21d35d6cb6614
push id30945
push usercbook@mozilla.com
push dateMon, 14 Nov 2016 09:22:29 +0000
treeherdermozilla-central@1196bf3032e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1315506
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();
 }