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
--- 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),
});
});