Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android' OR os == 'linux'
- 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,
testEngine_setup();
add_task(async function test_non_keyword() {
info("Searching for non-keyworded entry should autoFill it");
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addBookmarkWithDetails({
});
let context = createContext("moz", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
makeBookmarkResult(context, {
title: "A bookmark",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_keyword() {
info("Searching for keyworded entry should not autoFill it");
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addBookmarkWithDetails({
keyword: "moz",
});
let context = createContext("moz", { isPrivate: false });
await check_results({
context,
matches: [
makeKeywordSearchResult(context, {
keyword: "moz",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_more_than_keyword() {
info("Searching for more than keyworded entry should autoFill it");
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addBookmarkWithDetails({
keyword: "moz",
});
let context = createContext("mozi", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.org/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
makeBookmarkResult(context, {
title: "A bookmark",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_less_than_keyword() {
info("Searching for less than keyworded entry should autoFill it");
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addBookmarkWithDetails({
keyword: "moz",
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
search: "mo",
autofilled: "mozilla.org/",
matches: [
makeVisitResult(context, {
heuristic: true,
}),
makeBookmarkResult(context, {
title: "A bookmark",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_keyword_casing() {
info("Searching for keyworded entry is case-insensitive");
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addBookmarkWithDetails({
keyword: "moz",
});
let context = createContext("MoZ", { isPrivate: false });
await check_results({
context,
matches: [
makeKeywordSearchResult(context, {
keyword: "MoZ",
heuristic: true,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_less_then_equal_than_keyword_bug_1124238() {
info("Searching for less than keyworded entry should autoFill it");
await PlacesTestUtils.addVisits({
});
await PlacesTestUtils.addBookmarkWithDetails({
keyword: "moz",
});
let context = createContext("mo", { isPrivate: false });
await check_results({
context,
search: "mo",
autofilled: "mozilla.com/",
matches: [
makeVisitResult(context, {
title: "A bookmark",
heuristic: true,
}),
makeVisitResult(context, {
}),
],
});
// Search with an additional character. As the input matches a keyword, the
// completion should equal the keyword and not the URI as before.
context = createContext("moz", { isPrivate: false });
await check_results({
context,
matches: [
makeKeywordSearchResult(context, {
keyword: "moz",
heuristic: true,
}),
makeVisitResult(context, {
}),
],
});
// Search with an additional character. The input doesn't match a keyword
// anymore, it should be autofilled.
context = createContext("mozi", { isPrivate: false });
await check_results({
context,
autofilled: "mozilla.com/",
matches: [
makeVisitResult(context, {
title: "A bookmark",
heuristic: true,
}),
makeVisitResult(context, {
}),
],
});
await cleanupPlaces();
});