Bug 1176215. Ensure browser.search.suggest.enabled is true for the unifiedcomplete tests that need it. r=adw
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 28 Jun 2015 23:41:55 +0300
changeset 268622 b632a8d62d45982ba361d58826c9b0f13bd4dc7a
parent 268621 bed9dd9ca9cba5c9ac447d47a37dc18452732676
child 268623 f4688e6d02381624f5b7ecf8d37f02a94203522b
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1176215
milestone41.0a1
Bug 1176215. Ensure browser.search.suggest.enabled is true for the unifiedcomplete tests that need it. r=adw
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -35,16 +35,17 @@ function* cleanup() {
     "bookmark",
     "history.onlyTyped",
     "openpage",
     "searches",
   ];
   for (let type of suggestPrefs) {
     Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
   }
+  Services.prefs.clearUserPref("browser.search.suggest.enabled");
   yield PlacesUtils.bookmarks.eraseEverything();
   yield PlacesTestUtils.clearHistory();
 }
 do_register_cleanup(cleanup);
 
 /**
  * @param aSearches
  *        Array of AutoCompleteSearch names.
--- a/toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
@@ -1,13 +1,14 @@
 Cu.import("resource://gre/modules/FormHistory.jsm");
 
 const ENGINE_NAME = "engine-suggestions.xml";
 const SERVER_PORT = 9000;
 const SUGGEST_PREF = "browser.urlbar.suggest.searches";
+const SUGGEST_ENABLED_PREF = "browser.search.suggest.enabled";
 const SUGGEST_RESTRICT_TOKEN = "$";
 
 // Set this to some other function to change how the server converts search
 // strings into suggestions.
 let suggestionsFromSearchString = searchStr => {
   let suffixes = ["foo", "bar"];
   return suffixes.map(s => searchStr + " " + s);
 };
@@ -41,16 +42,17 @@ add_task(function* disabled() {
     search: "hello",
     matches: [],
   });
   yield cleanup();
 });
 
 add_task(function* singleWordQuery() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
+  Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
 
   let searchStr = "hello";
   yield check_autocomplete({
     search: searchStr,
     matches: [{
       uri: makeActionURI(("searchengine"), {
         engineName: ENGINE_NAME,
         input: searchStr,
@@ -73,16 +75,17 @@ add_task(function* singleWordQuery() {
     }],
   });
 
   yield cleanup();
 });
 
 add_task(function* multiWordQuery() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
+  Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
 
   let searchStr = "hello world";
   yield check_autocomplete({
     search: searchStr,
     matches: [{
       uri: makeActionURI(("searchengine"), {
         engineName: ENGINE_NAME,
         input: searchStr,
@@ -105,16 +108,17 @@ add_task(function* multiWordQuery() {
     }],
   });
 
   yield cleanup();
 });
 
 add_task(function* suffixMatch() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
+  Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
 
   let oldFn = suggestionsFromSearchString;
   suggestionsFromSearchString = searchStr => {
     let prefixes = ["baz", "quux"];
     return prefixes.map(p => p + " " + searchStr);
   };
 
   let searchStr = "hello";
@@ -144,16 +148,17 @@ add_task(function* suffixMatch() {
   });
 
   suggestionsFromSearchString = oldFn;
   yield cleanup();
 });
 
 add_task(function* restrictToken() {
   Services.prefs.setBoolPref(SUGGEST_PREF, true);
+  Services.prefs.setBoolPref(SUGGEST_ENABLED_PREF, true);
 
   // Add a visit and a bookmark.  Actually, make the bookmark visited too so
   // that it's guaranteed, with its higher frecency, to appear above the search
   // suggestions.
   yield PlacesTestUtils.addVisits([
     {
       uri: NetUtil.newURI("http://example.com/hello-visit"),
       title: "hello visit",