Ensure one-off search buttons are enabled in the URL bar while running browser_autocomplete_autoselect.js (bug 1303811). r=adw draft
authorPanos Astithas <past@mozilla.com>
Tue, 20 Sep 2016 11:07:10 +0300
changeset 415355 cb943ff116a6fe5566063c437ee596e46890de96
parent 415354 8a1efb73e7429df1dd35a4588c038b079bdf6018
child 531597 e0723b579f3974d22d32cc6f4264cbea95feb707
push id29859
push userbmo:past@mozilla.com
push dateTue, 20 Sep 2016 08:07:54 +0000
reviewersadw
bugs1303811
milestone52.0a1
Ensure one-off search buttons are enabled in the URL bar while running browser_autocomplete_autoselect.js (bug 1303811). r=adw MozReview-Commit-ID: CK97lT8SxV1
browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
--- a/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_autoselect.js
@@ -1,8 +1,10 @@
+const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
+
 function repeat(limit, func) {
   for (let i = 0; i < limit; i++) {
     func(i);
   }
 }
 
 function is_selected(index) {
   is(gURLBar.popup.richlistbox.selectedIndex, index, `Item ${index + 1} should be selected`);
@@ -21,18 +23,20 @@ function is_selected_one_off(index) {
   // selections, the test doesn't check that.
   is(gURLBar.popup.richlistbox.selectedIndex, -1,
      "A one-off is selected, so the listbox should not have a selection");
 }
 
 add_task(function*() {
   let maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
 
+  Services.prefs.setBoolPref(ONEOFF_URLBAR_PREF, true);
   registerCleanupFunction(function* () {
     yield PlacesTestUtils.clearHistory();
+    Services.prefs.clearUserPref(ONEOFF_URLBAR_PREF);
   });
 
   let visits = [];
   repeat(maxResults, i => {
     visits.push({
       uri: makeURI("http://example.com/autocomplete/?" + i),
     });
   });