Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: browser/components/urlbar/tests/unit/xpcshell.toml
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
// Functional tests for inline autocomplete
add_setup(async function () {
registerCleanupFunction(async () => {
Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
Services.prefs.clearUserPref("browser.urlbar.suggest.quickactions");
});
Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
Services.prefs.setBoolPref("browser.urlbar.suggest.quickactions", false);
});
add_task(async function test_urls_order() {
info("Add urls, check for correct order");
let places = [
];
await PlacesTestUtils.addVisits(places);
let context = createContext("vis", { isPrivate: false });
await check_results({
context,
autofilled: "visit2.mozilla.org/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
makeVisitResult(context, {
}),
],
});
await cleanupPlaces();
});
add_task(async function test_bookmark_first() {
info("With a bookmark and history, the query result should be the bookmark");
await PlacesTestUtils.addBookmarkWithDetails({
});
await PlacesTestUtils.addVisits(
);
let context = createContext("bookmark", { isPrivate: false });
await check_results({
context,
autofilled: "bookmark1.mozilla.org/",
matches: [
makeVisitResult(context, {
title: "A bookmark",
heuristic: true,
}),
makeVisitResult(context, {
}),
],
});
await cleanupPlaces();
});
add_task(async function test_complete_querystring() {
info("Check to make sure we autocomplete after ?");
await PlacesTestUtils.addVisits(
);
let context = createContext("smokey.mozilla.org/foo?", { isPrivate: false });
await check_results({
context,
autofilled: "smokey.mozilla.org/foo?bacon=delicious",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_complete_fragment() {
info("Check to make sure we autocomplete after #");
await PlacesTestUtils.addVisits(
);
let context = createContext("smokey.mozilla.org/foo?bacon=delicious#bar", {
isPrivate: false,
});
await check_results({
context,
autofilled: "smokey.mozilla.org/foo?bacon=delicious#bar",
matches: [
makeVisitResult(context, {
title:
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_prefix_autofill() {
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addVisits({
});
info("Should still autofill after a search is cancelled immediately");
let context = createContext("mozi", { isPrivate: false });
await check_results({
context,
incompleteSearch: "moz",
autofilled: "mozilla.org/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
makeVisitResult(context, {
providerName: "Places",
}),
],
});
await cleanupPlaces();
});