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,
const PLACES_PROVIDERNAME = "Places";
testEngine_setup();
add_task(async function test_no_slash() {
info("Searching for host match without slash should match host");
await PlacesTestUtils.addVisits([
]);
let context = createContext("file", { isPrivate: false });
await check_results({
context,
autofilled: "file.org/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
makeVisitResult(context, {
iconUri: UrlbarUtils.ICON.DEFAULT,
providerName: PLACES_PROVIDERNAME,
}),
makeVisitResult(context, {
providerName: PLACES_PROVIDERNAME,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_w_slash() {
info("Searching match with slash at the end should match url");
await PlacesTestUtils.addVisits(
{
},
{
}
);
let context = createContext("file.org/", { isPrivate: false });
await check_results({
context,
autofilled: "file.org/",
matches: [
makeVisitResult(context, {
removeSingleTrailingSlash: false,
}),
heuristic: true,
}),
makeVisitResult(context, {
providerName: PLACES_PROVIDERNAME,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_middle() {
info("Searching match with slash in the middle should match url");
await PlacesTestUtils.addVisits(
{
},
{
}
);
let context = createContext("file.org/t", { isPrivate: false });
await check_results({
context,
autofilled: "file.org/test/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_nonhost() {
info("Searching for non-host match without slash should not match url");
await PlacesTestUtils.addVisits({
});
let context = createContext("file", { isPrivate: false });
await check_results({
context,
matches: [
makeSearchResult(context, {
engineName: SUGGESTIONS_ENGINE_NAME,
heuristic: true,
}),
makeVisitResult(context, {
iconUri: UrlbarUtils.ICON.DEFAULT,
providerName: PLACES_PROVIDERNAME,
}),
],
});
await cleanupPlaces();
});