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
/* Any copyright is dedicated to the Public Domain.
"use strict";
testEngine_setup();
add_task(async function test_embedded_url_show_up_as_places_result() {
await PlacesTestUtils.addVisits([
{
title: "kitten",
},
]);
let context = createContext("kitten", {
isPrivate: false,
});
await check_results({
context,
matches: [
makeSearchResult(context, {
heuristic: true,
query: "kitten",
engineName: Services.search.defaultEngine.name,
}),
makeVisitResult(context, {
title: "kitten",
source: UrlbarUtils.RESULT_SOURCE.HISTORY,
}),
],
});
await cleanupPlaces();
});
add_task(async function test_deduplication_of_embedded_url_autofill_result() {
await PlacesTestUtils.addVisits([
{
title: "kitten",
},
{
title: "kitten",
},
]);
let context = createContext("kitten", {
isPrivate: false,
});
await check_results({
context,
matches: [
makeVisitResult(context, {
title: "kitten",
source: UrlbarUtils.RESULT_SOURCE.HISTORY,
heuristic: true,
providerName: "Autofill",
}),
],
});
await cleanupPlaces();
});
add_task(async function test_deduplication_of_embedded_url_places_result() {
await PlacesTestUtils.addVisits([
{
title: "kitten",
},
{
title: "kitten",
},
]);
let context = createContext("kitten", {
isPrivate: false,
allowAutofill: false,
});
await check_results({
context,
matches: [
makeSearchResult(context, {
heuristic: true,
query: "kitten",
engineName: Services.search.defaultEngine.name,
}),
makeVisitResult(context, {
title: "kitten",
source: UrlbarUtils.RESULT_SOURCE.HISTORY,
}),
],
});
await cleanupPlaces();
});
add_task(
async function test_deduplication_of_higher_frecency_embedded_url_places_result() {
await PlacesTestUtils.addVisits([
{
title: "kitten",
},
{
title: "kitten",
},
{
title: "kitten",
},
]);
let context = createContext("kitten", {
isPrivate: false,
allowAutofill: false,
});
await check_results({
context,
matches: [
makeSearchResult(context, {
heuristic: true,
query: "kitten",
engineName: Services.search.defaultEngine.name,
}),
makeVisitResult(context, {
title: "kitten",
source: UrlbarUtils.RESULT_SOURCE.HISTORY,
}),
],
});
await cleanupPlaces();
}
);
add_task(
async function test_deduplication_of_embedded_encoded_url_places_result() {
await PlacesTestUtils.addVisits([
{
title: "kitten",
},
{
title: "kitten",
},
]);
let context = createContext("kitten", {
isPrivate: false,
allowAutofill: false,
});
await check_results({
context,
matches: [
makeSearchResult(context, {
heuristic: true,
query: "kitten",
engineName: Services.search.defaultEngine.name,
}),
makeVisitResult(context, {
title: "kitten",
source: UrlbarUtils.RESULT_SOURCE.HISTORY,
}),
],
});
await cleanupPlaces();
}
);
add_task(async function test_deduplication_of_embedded_url_switchTab_result() {
await PlacesTestUtils.addVisits([
{
title: "kitten",
},
{
uri,
title: "kitten",
},
]);
await addOpenPages(uri, 1);
let context = createContext("kitten", {
isPrivate: false,
allowAutofill: false,
});
await check_results({
context,
matches: [
makeSearchResult(context, {
heuristic: true,
query: "kitten",
engineName: Services.search.defaultEngine.name,
}),
makeTabSwitchResult(context, {
source: UrlbarUtils.RESULT_SOURCE.TAB,
title: "kitten",
}),
],
});
await removeOpenPages(uri, 1);
await cleanupPlaces();
});