mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-13 02:37:32 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,68 @@
|
|||
add_task(function* test_enabled() {
|
||||
// Test for bug 471903 to make sure searching in autocomplete can be turned on
|
||||
// and off. Also test bug 463535 for pref changing search.
|
||||
let uri = NetUtil.newURI("http://url/0");
|
||||
yield PlacesTestUtils.addVisits([ { uri: uri, title: "title" } ]);
|
||||
|
||||
do_print("plain search");
|
||||
yield check_autocomplete({
|
||||
search: "url",
|
||||
matches: [ { uri: uri, title: "title" } ]
|
||||
});
|
||||
|
||||
do_print("search disabled");
|
||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
|
||||
yield check_autocomplete({
|
||||
search: "url",
|
||||
matches: [ ]
|
||||
});
|
||||
|
||||
do_print("resume normal search");
|
||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
|
||||
yield check_autocomplete({
|
||||
search: "url",
|
||||
matches: [ { uri: uri, title: "title" } ]
|
||||
});
|
||||
|
||||
yield cleanup();
|
||||
});
|
||||
|
||||
add_task(function* test_sync_enabled() {
|
||||
// Initialize unified complete.
|
||||
Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
|
||||
.getService(Ci.mozIPlacesAutoComplete);
|
||||
|
||||
let types = [ "history", "bookmark", "openpage", "searches" ];
|
||||
|
||||
// Test the service keeps browser.urlbar.autocomplete.enabled synchronized
|
||||
// with browser.urlbar.suggest prefs.
|
||||
for (let type of types) {
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest." + type, true);
|
||||
}
|
||||
Assert.equal(Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled"), true);
|
||||
|
||||
// Disable autocomplete and check all the suggest prefs are set to false.
|
||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
|
||||
for (let type of types) {
|
||||
Assert.equal(Services.prefs.getBoolPref("browser.urlbar.suggest." + type), false);
|
||||
}
|
||||
|
||||
// Setting even a single suggest pref to true should enable autocomplete.
|
||||
Services.prefs.setBoolPref("browser.urlbar.suggest.history", true);
|
||||
for (let type of types.filter(t => t != "history")) {
|
||||
Assert.equal(Services.prefs.getBoolPref("browser.urlbar.suggest." + type), false);
|
||||
}
|
||||
Assert.equal(Services.prefs.getBoolPref("browser.urlbar.autocomplete.enabled"), true);
|
||||
|
||||
// Disable autocoplete again, then re-enable it and check suggest prefs
|
||||
// have been reset.
|
||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
|
||||
Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
|
||||
for (let type of types.filter(t => t != "history")) {
|
||||
if (type == "searches") {
|
||||
Assert.equal(Services.prefs.getBoolPref("browser.urlbar.suggest." + type), false);
|
||||
} else {
|
||||
Assert.equal(Services.prefs.getBoolPref("browser.urlbar.suggest." + type), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue