Bug 901198 Ensure safe browsing is enabled when running test_app_rep.js so that testing applications that don't enable it will pass as well. r=paolo,a=test-only
authorMark Banner <bugzilla@standard8.plus.com>
Mon, 05 Aug 2013 10:16:30 +0100
changeset 153658 fbfcc7ebcf2e83b63cb2742b973038e1a4eeb9d5
parent 153657 4d1bee1f678ea9c2a99c0ba19d39ce47d91036f5
child 153659 3f5564f3621232494e21d6f35618b3621b107b91
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo, test-only
bugs901198
milestone25.0a2
Bug 901198 Ensure safe browsing is enabled when running test_app_rep.js so that testing applications that don't enable it will pass as well. r=paolo,a=test-only
toolkit/components/downloads/test/unit/test_app_rep.js
--- a/toolkit/components/downloads/test/unit/test_app_rep.js
+++ b/toolkit/components/downloads/test/unit/test_app_rep.js
@@ -14,16 +14,23 @@ const ApplicationReputationQuery = Compo
 const gAppRep = Cc["@mozilla.org/downloads/application-reputation-service;1"].
                   getService(Ci.nsIApplicationReputationService);
 let gHttpServ = null;
 
 function run_test() {
   // Set up a local HTTP server to return bad verdicts.
   Services.prefs.setCharPref("browser.safebrowsing.appRepURL",
                              "http://localhost:4444/download");
+  // Ensure safebrowsing is enabled for this test, even if the app
+  // doesn't have it enabled.
+  Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", true);
+  do_register_cleanup(function() {
+    Services.prefs.clearUserPref("browser.safebrowsing.malware.enabled");
+  });
+
   gHttpServ = new HttpServer();
   gHttpServ.registerDirectory("/", do_get_cwd());
 
   function createVerdict(aShouldBlock) {
     // We can't programmatically create a protocol buffer here, so just
     // hardcode some already serialized ones.
     blob = String.fromCharCode(parseInt(0x08, 16));
     if (aShouldBlock) {