Backed out changeset 2227c747a95b (bug 1520833) for failing browser/components/urlbar/tests/unit/test_providerUnifiedComplete.js on a CLOSED TREE

This commit is contained in:
Oana Pop Rus 2019-01-19 02:29:06 +02:00
parent 8f49277c52
commit 28f71e381a
2 changed files with 7 additions and 23 deletions

View File

@ -305,13 +305,11 @@ function makeUrlbarMatch(tokens, info) {
}
// This is a normal url/title tuple.
let source;
let tags = [];
let comment = info.comment;
let source, tags, comment;
let hasTags = info.style.includes("tag");
if (info.style.includes("bookmark") || hasTags) {
source = UrlbarUtils.MATCH_SOURCE.BOOKMARKS;
if (hasTags) {
if (info.style.includes("tag")) {
// Split title and tags.
[comment, tags] = info.comment.split(TITLE_TAGS_SEPARATOR);
tags = tags.split(",").map(t => t.trim());

View File

@ -32,22 +32,16 @@ add_task(async function test_unifiedComplete() {
let context = createContext("moz", {isPrivate: false});
// Add entries from multiple sources.
await PlacesTestUtils.addVisits("https://history.mozilla.org/");
await PlacesUtils.bookmarks.insert({
url: "https://bookmark.mozilla.org/",
title: "Test bookmark",
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
});
await PlacesTestUtils.addVisits([
{uri: "https://history.mozilla.org/", title: "Test history"},
{uri: "https://tab.mozilla.org/", title: "Test tab"},
]);
await PlacesTestUtils.addVisits("https://tab.mozilla.org/");
UrlbarProviderOpenTabs.registerOpenTab("https://tab.mozilla.org/", 0);
await controller.startQuery(context);
info("Results:\n" + context.results.map(m => `${m.title} - ${m.payload.url}`).join("\n"));
Assert.equal(context.results.length, 6, "Found the expected number of matches");
dump(context.results.map(m => m.title + " " + m.payload.url) + "\n");
Assert.deepEqual([
UrlbarUtils.MATCH_TYPE.SEARCH,
UrlbarUtils.MATCH_TYPE.SEARCH,
@ -55,14 +49,6 @@ add_task(async function test_unifiedComplete() {
UrlbarUtils.MATCH_TYPE.URL,
UrlbarUtils.MATCH_TYPE.TAB_SWITCH,
UrlbarUtils.MATCH_TYPE.URL,
], context.results.map(m => m.type), "Check match types");
Assert.deepEqual([
"engine-suggestions.xml",
"engine-suggestions.xml",
"engine-suggestions.xml",
"Test bookmark",
"Test tab",
"Test history",
], context.results.map(m => m.title), "Check match titles");
], context.results.map(m => m.type), "Check matches");
Assert.equal(context.results.length, 6, "Found the expected number of matches");
});