Bug 1065191 - Add test coverage for the style property of places autocomplete results. r=paolo

This commit is contained in:
Blair McBride 2014-11-12 23:03:30 +13:00
parent 9469716a8b
commit e400aef44f
19 changed files with 221 additions and 211 deletions

View File

@ -154,21 +154,28 @@ function* check_autocomplete(test) {
if (matches[j] == undefined)
continue;
let { uri, title, tags, searchEngine } = matches[j];
let { uri, title, tags, searchEngine, style } = matches[j];
if (tags)
title += " \u2013 " + tags.sort().join(", ");
if (searchEngine)
title += TITLE_SEARCH_ENGINE_SEPARATOR + searchEngine;
if (style)
style = style.sort();
else
style = ["favicon"];
do_log_info("Checking against expected '" + uri.spec + "', '" + title + "'...");
// Got a match on both uri and title?
if (stripPrefix(uri.spec) == stripPrefix(value) && title == comment) {
do_log_info("Got a match at index " + j + "!");
let actualStyle = controller.getStyleAt(i).split(/\W+/).sort();
if (style)
Assert.equal(actualStyle.toString(), style.toString(), "Match should have expected style");
// Make it undefined so we don't process it again
matches[j] = undefined;
if (uri.spec.startsWith("moz-action:")) {
let style = controller.getStyleAt(i);
Assert.ok(style.contains("action"));
Assert.ok(actualStyle.indexOf("action") != -1, "moz-action results should always have 'action' in their style");
}
break;
}

View File

@ -16,7 +16,7 @@ add_task(function* test_tag_match_has_bookmark_title() {
tags: [ "superTag" ]});
yield check_autocomplete({
search: "superTag",
matches: [ { uri: uri, title: "Bookmark title", tags: [ "superTag" ] } ]
matches: [ { uri: uri, title: "Bookmark title", tags: [ "superTag" ], style: [ "tag" ] } ]
});
yield cleanup();
});

View File

@ -22,14 +22,16 @@ add_task(function* test_tag_match_url() {
{ uri: uri2, title: "title" } ]);
addBookmark({ uri: uri1,
title: "title",
tags: [ "superTag" ]});
tags: [ "superTag" ],
style: [ "tag" ] });
addBookmark({ uri: uri2,
title: "title",
tags: [ "superTag" ]});
tags: [ "superTag" ],
style: [ "tag" ] });
yield check_autocomplete({
search: "superTag",
matches: [ { uri: uri1, title: "title", tags: [ "superTag" ] },
{ uri: uri2, title: "title", tags: [ "superTag" ] } ]
matches: [ { uri: uri1, title: "title", tags: [ "superTag" ], style: [ "tag" ] },
{ uri: uri2, title: "title", tags: [ "superTag" ], style: [ "tag" ] } ]
});
yield cleanup();
});

View File

@ -32,7 +32,7 @@ add_task(function* test_javascript_match() {
yield check_autocomplete({
search: "javascript:",
matches: [ { uri: uri1, title: "Title with javascript:" },
{ uri: uri2, title: "Title with javascript:" } ]
{ uri: uri2, title: "Title with javascript:", style: [ "bookmark" ]} ]
});
do_log_info("Match nothing with non-first javascript:");
@ -44,7 +44,7 @@ add_task(function* test_javascript_match() {
do_log_info("Match javascript: with multi-word search");
yield check_autocomplete({
search: "javascript: 5",
matches: [ { uri: uri2, title: "Title with javascript:" } ]
matches: [ { uri: uri2, title: "Title with javascript:", style: [ "bookmark" ]} ]
});
yield cleanup();

View File

@ -33,32 +33,32 @@ add_task(function* test_javascript_match() {
do_log_info("Make sure tags come back in the title when matching tags");
yield check_autocomplete({
search: "page1 tag",
matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ] } ]
matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ], style: [ "tag" ] } ]
});
do_log_info("Check tags in title for page2");
yield check_autocomplete({
search: "page2 tag",
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ] } ]
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "tag" ] } ]
});
do_log_info("Make sure tags appear even when not matching the tag");
yield check_autocomplete({
search: "page3",
matches: [ { uri: uri3, title: "tagged", tags: [ "tag1", "tag3" ] } ]
matches: [ { uri: uri3, title: "tagged", tags: [ "tag1", "tag3" ], style: [ "tag" ] } ]
});
do_log_info("Multiple tags come in commas for page4");
yield check_autocomplete({
search: "page4",
matches: [ { uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ] } ]
matches: [ { uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "tag" ] } ]
});
do_log_info("Extra test just to make sure we match the title");
yield check_autocomplete({
search: "tag2",
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ] },
{ uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ] } ]
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "tag" ] },
{ uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "tag" ] } ]
});
yield cleanup();

View File

@ -34,7 +34,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict history, typed visit, should autoFill");
yield check_autocomplete({
search: "ty",
matches: [ { uri: uri1, title: "typed" } ],
matches: [ { uri: uri1, title: "typed", style: [ "autofill" ] } ],
autofilled: "typed/",
completed: "typed/"
});
@ -52,7 +52,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict history, typed bookmark, should autoFill");
yield check_autocomplete({
search: "tp",
matches: [ { uri: uri4, title: "tpbk" } ],
matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ],
autofilled: "tpbk/",
completed: "tpbk/"
});
@ -65,7 +65,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict history, bookmark, autoFill.typed = false, should autoFill");
yield check_autocomplete({
search: "bo",
matches: [ { uri: uri3, title: "bookmarked" } ],
matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ], style: [ "autofill" ] } ],
autofilled: "bookmarked/",
completed: "bookmarked/"
});
@ -73,7 +73,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict history, common visit, autoFill.typed = false, should autoFill");
yield check_autocomplete({
search: "vi",
matches: [ { uri: uri2, title: "visited" } ],
matches: [ { uri: uri2, title: "visited", style: [ "autofill" ] } ],
autofilled: "visited/",
completed: "visited/"
});
@ -94,7 +94,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict typed, typed visit, autofill.typed = false, should autoFill");
yield check_autocomplete({
search: "ty",
matches: [ { uri: uri1, title: "typed" } ],
matches: [ { uri: uri1, title: "typed", style: [ "autofill" ] } ],
autofilled: "typed/",
completed: "typed/"
});
@ -110,7 +110,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict typed, typed bookmark, autofill.typed = false, should autoFill");
yield check_autocomplete({
search: "tp",
matches: [ { uri: uri4, title: "tpbk" } ],
matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ],
autofilled: "tpbk/",
completed: "tpbk/"
});
@ -139,7 +139,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict bookmarks, bookmark, should not autoFill");
yield check_autocomplete({
search: "bo",
matches: [ { uri: uri3, title: "bookmarked" } ],
matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ] } ],
autofilled: "bo",
completed: "bo"
});
@ -148,7 +148,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict bookmarks, typed bookmark, should autoFill");
yield check_autocomplete({
search: "tp",
matches: [ { uri: uri4, title: "tpbk" } ],
matches: [ { uri: uri4, title: "tpbk", style: [ "autofill" ] } ],
autofilled: "tpbk/",
completed: "tpbk/"
});
@ -158,7 +158,7 @@ add_task(function* test_default_behavior_host() {
do_log_info("Restrict bookmarks, bookmark, autofill.typed = false, should autoFill");
yield check_autocomplete({
search: "bo",
matches: [ { uri: uri3, title: "bookmarked" } ],
matches: [ { uri: uri3, title: "bookmarked", style: [ "autofill" ] } ],
autofilled: "bookmarked/",
completed: "bookmarked/"
});
@ -196,7 +196,7 @@ add_task(function* test_default_behavior_url() {
do_log_info("URL: Restrict history, typed visit, should autoFill");
yield check_autocomplete({
search: "typed/t",
matches: [ { uri: uri1, title: "typed/ty/" } ],
matches: [ { uri: uri1, title: "typed/ty/", style: [ "autofill" ] } ],
autofilled: "typed/ty/",
completed: "http://typed/ty/"
});
@ -214,7 +214,7 @@ add_task(function* test_default_behavior_url() {
do_log_info("URL: Restrict history, typed bookmark, should autoFill");
yield check_autocomplete({
search: "tpbk/t",
matches: [ { uri: uri4, title: "tpbk/tp/" } ],
matches: [ { uri: uri4, title: "tpbk/tp/", style: [ "autofill" ] } ],
autofilled: "tpbk/tp/",
completed: "http://tpbk/tp/"
});
@ -242,7 +242,7 @@ add_task(function* test_default_behavior_url() {
do_log_info("URL: Restrict bookmarks, bookmark, should not autoFill");
yield check_autocomplete({
search: "bookmarked/b",
matches: [ { uri: uri3, title: "bookmarked" } ],
matches: [ { uri: uri3, title: "bookmarked", style: [ "bookmark" ] } ],
autofilled: "bookmarked/b",
completed: "bookmarked/b"
});
@ -251,7 +251,7 @@ add_task(function* test_default_behavior_url() {
do_log_info("URL: Restrict bookmarks, typed bookmark, should autoFill");
yield check_autocomplete({
search: "tpbk/t",
matches: [ { uri: uri4, title: "tpbk/tp/" } ],
matches: [ { uri: uri4, title: "tpbk/tp/", style: [ "autofill" ] } ],
autofilled: "tpbk/tp/",
completed: "http://tpbk/tp/"
});
@ -261,7 +261,7 @@ add_task(function* test_default_behavior_url() {
do_log_info("URL: Restrict bookmarks, bookmark, autofill.typed = false, should autoFill");
yield check_autocomplete({
search: "bookmarked/b",
matches: [ { uri: uri3, title: "bookmarked/bo/" } ],
matches: [ { uri: uri3, title: "bookmarked/bo/", style: [ "autofill" ] } ],
autofilled: "bookmarked/bo/",
completed: "http://bookmarked/bo/"
});

View File

@ -38,19 +38,19 @@ add_task(function* test_download_embed_bookmarks() {
do_log_info("Searching for bookmarked download uri matches");
yield check_autocomplete({
search: "download-bookmark",
matches: [ { uri: uri1, title: "download-bookmark" } ]
matches: [ { uri: uri1, title: "download-bookmark", style: [ "bookmark" ] } ]
});
do_log_info("Searching for bookmarked embed uri matches");
yield check_autocomplete({
search: "embed-bookmark",
matches: [ { uri: uri2, title: "embed-bookmark" } ]
matches: [ { uri: uri2, title: "embed-bookmark", style: [ "bookmark" ] } ]
});
do_log_info("Searching for bookmarked framed uri matches");
yield check_autocomplete({
search: "framed-bookmark",
matches: [ { uri: uri3, title: "framed-bookmark" } ]
matches: [ { uri: uri3, title: "framed-bookmark", style: [ "bookmark" ] } ]
});
do_log_info("Searching for download uri does not match");

View File

@ -13,7 +13,8 @@ add_task(function* test_dupe_urls() {
autofilled: "mozilla.org/",
completed: "mozilla.org/",
matches: [ { uri: NetUtil.newURI("http://mozilla.org/"),
title: "mozilla.org" } ]
title: "mozilla.org",
style: [ "autofill" ] } ]
});
yield cleanup();
});

View File

@ -40,11 +40,11 @@ add_task(function* test_javascript_match() {
yield check_autocomplete({
search: "foo",
matches: [ { uri: uri1, title: "title" },
{ uri: uri2, title: "title" },
{ uri: uri2, title: "title", style: ["bookmark"] },
{ uri: uri3, title: "title" },
{ uri: uri4, title: "title" },
{ uri: uri5, title: "title" },
{ uri: uri6, title: "title" } ]
{ uri: uri4, title: "title", style: ["bookmark"] },
{ uri: uri5, title: "title", style: ["bookmark"] },
{ uri: uri6, title: "title", style: ["bookmark"] } ]
});
do_log_info("Match only typed history");
@ -66,11 +66,11 @@ add_task(function* test_javascript_match() {
yield check_autocomplete({
search: "",
matches: [ { uri: uri1, title: "title" },
{ uri: uri2, title: "title" },
{ uri: uri2, title: "title", style: ["bookmark"] },
{ uri: uri3, title: "title" },
{ uri: uri4, title: "title" },
{ uri: uri5, title: "title" },
{ uri: uri6, title: "title" } ]
{ uri: uri4, title: "title", style: ["bookmark"] },
{ uri: uri5, title: "title", style: ["bookmark"] },
{ uri: uri6, title: "title", style: ["bookmark"] } ]
});
do_log_info("Drop-down empty search matches only typed");
@ -78,8 +78,8 @@ add_task(function* test_javascript_match() {
yield check_autocomplete({
search: "",
matches: [ { uri: uri3, title: "title" },
{ uri: uri4, title: "title" },
{ uri: uri6, title: "title" } ]
{ uri: uri4, title: "title", style: ["bookmark"] },
{ uri: uri6, title: "title", style: ["bookmark"] } ]
});
do_log_info("Drop-down empty search matches only typed history");

View File

@ -22,55 +22,55 @@ add_task(function* test_keyword_searc() {
do_log_info("Plain keyword query");
yield check_autocomplete({
search: "key term",
matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search=term"), title: "Keyword title", style: ["keyword"] } ]
});
do_log_info("Multi-word keyword query");
yield check_autocomplete({
search: "key multi word",
matches: [ { uri: NetUtil.newURI("http://abc/?search=multi+word"), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search=multi+word"), title: "Keyword title", style: ["keyword"] } ]
});
do_log_info("Keyword query with +");
yield check_autocomplete({
search: "key blocking+",
matches: [ { uri: NetUtil.newURI("http://abc/?search=blocking%2B"), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search=blocking%2B"), title: "Keyword title", style: ["keyword"] } ]
});
do_log_info("Unescaped term in query");
yield check_autocomplete({
search: "key ユニコード",
matches: [ { uri: NetUtil.newURI("http://abc/?search=ユニコード"), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search=ユニコード"), title: "Keyword title", style: ["keyword"] } ]
});
do_log_info("Keyword that happens to match a page");
yield check_autocomplete({
search: "key ThisPageIsInHistory",
matches: [ { uri: NetUtil.newURI("http://abc/?search=ThisPageIsInHistory"), title: "Generic page title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search=ThisPageIsInHistory"), title: "Generic page title", style: ["bookmark"] } ]
});
do_log_info("Keyword without query (without space)");
yield check_autocomplete({
search: "key",
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ]
});
do_log_info("Keyword without query (with space)");
yield check_autocomplete({
search: "key ",
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search="), title: "Keyword title", style: ["keyword"] } ]
});
// This adds a second keyword so anything after this will match 2 keywords
let uri3 = NetUtil.newURI("http://xyz/?foo=%s");
yield promiseAddVisits([ { uri: uri3, title: "Generic page title" } ]);
addBookmark({ uri: uri3, title: "Keyword title", keyword: "key"});
addBookmark({ uri: uri3, title: "Keyword title", keyword: "key", style: ["keyword"] });
do_log_info("Two keywords matched");
yield check_autocomplete({
search: "key twoKey",
matches: [ { uri: NetUtil.newURI("http://abc/?search=twoKey"), title: "Keyword title" },
{ uri: NetUtil.newURI("http://xyz/?foo=twoKey"), title: "Keyword title" } ]
matches: [ { uri: NetUtil.newURI("http://abc/?search=twoKey"), title: "Keyword title", style: ["keyword"] },
{ uri: NetUtil.newURI("http://xyz/?foo=twoKey"), title: "Keyword title", style: ["keyword"] } ]
});
yield cleanup();

View File

@ -23,49 +23,49 @@ add_task(function* test_keyword_search() {
yield check_autocomplete({
search: "key term",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=term", input: "key term"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
do_log_info("Multi-word keyword query");
yield check_autocomplete({
search: "key multi word",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=multi+word", input: "key multi word"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=multi+word", input: "key multi word"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
do_log_info("Keyword query with +");
yield check_autocomplete({
search: "key blocking+",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=blocking%2B", input: "key blocking+"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=blocking%2B", input: "key blocking+"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
do_log_info("Unescaped term in query");
yield check_autocomplete({
search: "key ユニコード",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ユニコード", input: "key ユニコード"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ユニコード", input: "key ユニコード"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
do_log_info("Keyword that happens to match a page");
yield check_autocomplete({
search: "key ThisPageIsInHistory",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ThisPageIsInHistory", input: "key ThisPageIsInHistory"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=ThisPageIsInHistory", input: "key ThisPageIsInHistory"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
do_log_info("Keyword without query (without space)");
yield check_autocomplete({
search: "key",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
do_log_info("Keyword without query (with space)");
yield check_autocomplete({
search: "key ",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key "}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=", input: "key "}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
// This adds a second keyword so anything after this will match 2 keywords
@ -77,8 +77,8 @@ add_task(function* test_keyword_search() {
yield check_autocomplete({
search: "key twoKey",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=twoKey", input: "key twoKey"}), title: "Keyword title" },
{ uri: makeActionURI("keyword", {url: "http://xyz/?foo=twoKey", input: "key twoKey"}), title: "Keyword title" } ]
matches: [ { uri: makeActionURI("keyword", {url: "http://abc/?search=twoKey", input: "key twoKey"}), title: "Keyword title", style: [ "action", "keyword" ] },
{ uri: makeActionURI("keyword", {url: "http://xyz/?foo=twoKey", input: "key twoKey"}), title: "Keyword title", style: [ "action", "keyword" ] } ]
});
yield cleanup();

View File

@ -41,13 +41,13 @@ add_task(function* test_match_beginning() {
yield check_autocomplete({
search: "b a z",
matches: [ { uri: uri2, title: "b(a)r b<a>z" },
{ uri: uri4, title: "b(a)r b<a>z" } ]
{ uri: uri4, title: "b(a)r b<a>z", style: [ "bookmark" ] } ]
});
do_log_info("Match 2 terms in url and 1 in title; make sure bookmark title is used for search");
yield check_autocomplete({
search: "k f t",
matches: [ { uri: uri3, title: "f(o)o b<a>r" } ]
matches: [ { uri: uri3, title: "f(o)o b<a>r", style: [ "bookmark" ] } ]
});
do_log_info("Match 3 terms in url and 1 in title");

View File

@ -14,19 +14,19 @@ add_task(function*() {
yield check_autocomplete({
search: "doit",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "doit", searchQuery: "doit"}), title: "MozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "doit", searchQuery: "doit"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
});
yield check_autocomplete({
search: "doit mozilla",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "AliasedMozSearch", input: "doit mozilla", searchQuery: "mozilla", alias: "doit"}), title: "AliasedMozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "AliasedMozSearch", input: "doit mozilla", searchQuery: "mozilla", alias: "doit"}), title: "AliasedMozSearch", style: [ "action", "searchengine" ] }, ]
});
yield check_autocomplete({
search: "doit mozzarella mozilla",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "AliasedMozSearch", input: "doit mozzarella mozilla", searchQuery: "mozzarella mozilla", alias: "doit"}), title: "AliasedMozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "AliasedMozSearch", input: "doit mozzarella mozilla", searchQuery: "mozzarella mozilla", alias: "doit"}), title: "AliasedMozSearch", style: [ "action", "searchengine" ] }, ]
});
yield cleanup();

View File

@ -14,21 +14,21 @@ add_task(function*() {
yield check_autocomplete({
search: "mozilla",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
});
do_log_info("search engine, uri-like input");
yield check_autocomplete({
search: "http:///",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "http:///", searchQuery: "http:///"}), title: "MozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "http:///", searchQuery: "http:///"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
});
do_log_info("search engine, multiple words");
yield check_autocomplete({
search: "mozzarella cheese",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozzarella cheese", searchQuery: "mozzarella cheese"}), title: "MozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozzarella cheese", searchQuery: "mozzarella cheese"}), title: "MozSearch", style: [ "action", "searchengine" ] }, ]
});
do_log_info("search engine, after current engine has changed");
@ -40,7 +40,7 @@ add_task(function*() {
yield check_autocomplete({
search: "mozilla",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch2", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch2" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch2", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch2", style: [ "action", "searchengine" ] }, ]
});
yield cleanup();

View File

@ -17,8 +17,8 @@ add_task(function* test_searchEngine() {
do_log_info("Past search terms should be styled, unless bookmarked");
yield check_autocomplete({
search: "term",
matches: [ { uri: uri1, title: "Terms", searchEngine: "SearchEngine" },
{ uri: uri2, title: "Terms - SearchEngine Search" } ]
matches: [ { uri: uri1, title: "Terms", searchEngine: "SearchEngine", style: ["favicon", "search"] },
{ uri: uri2, title: "Terms - SearchEngine Search", style: ["bookmark"] } ]
});
yield cleanup();

View File

@ -53,23 +53,23 @@ add_task(function* test_special_searches() {
do_log_info("Star restrict");
yield check_autocomplete({
search: "*",
matches: [ { uri: uri5, title: "title" },
{ uri: uri6, title: "foo.bar" },
{ uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar"] },
{ uri: uri12, title: "foo.bar", tags: ["foo.bar"] } ]
matches: [ { uri: uri5, title: "title", style: [ "bookmark" ] },
{ uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar"], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: ["foo.bar"], style: [ "tag" ] } ]
});
do_log_info("Tag restrict");
yield check_autocomplete({
search: "+",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
// Test specials as any word position
@ -129,26 +129,26 @@ add_task(function* test_special_searches() {
resetRestrict("history");
yield check_autocomplete({
search: "foo *",
matches: [ { uri: uri6, title: "foo.bar" },
{ uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo | -> is star (change pref)");
changeRestrict("bookmark", "|");
yield check_autocomplete({
search: "foo |",
matches: [ { uri: uri6, title: "foo.bar" },
{ uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo # -> in title");
@ -157,12 +157,12 @@ add_task(function* test_special_searches() {
search: "foo #",
matches: [ { uri: uri2, title: "foo.bar" },
{ uri: uri4, title: "foo.bar" },
{ uri: uri6, title: "foo.bar" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
{ uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo | -> in title (change pref)");
@ -171,12 +171,12 @@ add_task(function* test_special_searches() {
search: "foo |",
matches: [ { uri: uri2, title: "foo.bar" },
{ uri: uri4, title: "foo.bar" },
{ uri: uri6, title: "foo.bar" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
{ uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo @ -> in url");
@ -185,10 +185,10 @@ add_task(function* test_special_searches() {
search: "foo @",
matches: [ { uri: uri3, title: "title" },
{ uri: uri4, title: "foo.bar" },
{ uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo | -> in url (change pref)");
@ -197,30 +197,30 @@ add_task(function* test_special_searches() {
search: "foo |",
matches: [ { uri: uri3, title: "title" },
{ uri: uri4, title: "foo.bar" },
{ uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo + -> is tag");
resetRestrict("url");
yield check_autocomplete({
search: "foo +",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo | -> is tag (change pref)");
changeRestrict("tag", "|");
yield check_autocomplete({
search: "foo |",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo ~ -> is typed");
@ -228,7 +228,7 @@ add_task(function* test_special_searches() {
yield check_autocomplete({
search: "foo ~",
matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo | -> is typed (change pref)");
@ -236,7 +236,7 @@ add_task(function* test_special_searches() {
yield check_autocomplete({
search: "foo |",
matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
// Test various pairs of special searches
@ -244,8 +244,8 @@ add_task(function* test_special_searches() {
resetRestrict("typed");
yield check_autocomplete({
search: "foo ^ *",
matches: [ { uri: uri6, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo ^ # -> history, in title");
@ -268,7 +268,7 @@ add_task(function* test_special_searches() {
do_log_info("foo ^ + -> history, is tag");
yield check_autocomplete({
search: "foo ^ +",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo ^ ~ -> history, is typed");
@ -281,81 +281,81 @@ add_task(function* test_special_searches() {
do_log_info("foo * # -> is star, in title");
yield check_autocomplete({
search: "foo * #",
matches: [ { uri: uri6, title: "foo.bar" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo * @ -> is star, in url");
yield check_autocomplete({
search: "foo * @",
matches: [ { uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo * + -> same as +");
yield check_autocomplete({
search: "foo * +",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo * ~ -> is star, is typed");
yield check_autocomplete({
search: "foo * ~",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo # @ -> in title, in url");
yield check_autocomplete({
search: "foo # @",
matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo # + -> in title, is tag");
yield check_autocomplete({
search: "foo # +",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo # ~ -> in title, is typed");
yield check_autocomplete({
search: "foo # ~",
matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo @ + -> in url, is tag");
yield check_autocomplete({
search: "foo @ +",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo @ ~ -> in url, is typed");
yield check_autocomplete({
search: "foo @ ~",
matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo + ~ -> is tag, is typed");
yield check_autocomplete({
search: "foo + ~",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
// Disable autoFill for the next tests, see test_autoFill_default_behavior.js
@ -378,22 +378,22 @@ add_task(function* test_special_searches() {
Services.prefs.setIntPref("browser.urlbar.default.behavior", 3);
yield check_autocomplete({
search: "foo",
matches: [ { uri: uri6, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo -> default history, is star, is typed");
Services.prefs.setIntPref("browser.urlbar.default.behavior", 35);
yield check_autocomplete({
search: "foo",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo -> default history, is star, in url");
Services.prefs.setIntPref("browser.urlbar.default.behavior", 19);
yield check_autocomplete({
search: "foo",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
// Change the default to be less restrictive to make sure we find more
@ -401,10 +401,10 @@ add_task(function* test_special_searches() {
Services.prefs.setIntPref("browser.urlbar.default.behavior", 18);
yield check_autocomplete({
search: "foo",
matches: [ { uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
matches: [ { uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
do_log_info("foo -> default in url");
@ -413,10 +413,10 @@ add_task(function* test_special_searches() {
search: "foo",
matches: [ { uri: uri3, title: "title" },
{ uri: uri4, title: "foo.bar" },
{ uri: uri7, title: "title" },
{ uri: uri8, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ] } ]
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
});
yield cleanup();

View File

@ -27,17 +27,17 @@ add_task(function* test_tab_matches() {
yield check_autocomplete({
search: "abc.com",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "http://abc.com/", input: "abc.com"}), title: "http://abc.com/" },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks" } ]
matches: [ { uri: makeActionURI("visiturl", {url: "http://abc.com/", input: "abc.com"}), title: "http://abc.com/", style: [ "action", "visiturl" ] },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] } ]
});
do_log_info("three results, one tab match");
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks" },
{ uri: uri2, title: "xyz.net - we're better than ABC" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_log_info("three results, both normal results are tab matches");
@ -45,9 +45,9 @@ add_task(function* test_tab_matches() {
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks" },
{ uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] },
{ uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC", style: [ "action", "switchtab" ] } ]
});
do_log_info("three results, both normal results are tab matches, one has multiple tabs");
@ -55,9 +55,9 @@ add_task(function* test_tab_matches() {
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks" },
{ uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] },
{ uri: makeActionURI("switchtab", {url: "http://xyz.net/"}), title: "xyz.net - we're better than ABC", style: [ "action", "switchtab" ] } ]
});
do_log_info("three results, no tab matches");
@ -66,9 +66,9 @@ add_task(function* test_tab_matches() {
yield check_autocomplete({
search: "abc",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch" },
{ uri: uri1, title: "ABC rocks" },
{ uri: uri2, title: "xyz.net - we're better than ABC" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "abc", searchQuery: "abc"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
{ uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_log_info("tab match search with restriction character");
@ -76,34 +76,34 @@ add_task(function* test_tab_matches() {
yield check_autocomplete({
search: gTabRestrictChar + " abc",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: gTabRestrictChar + " abc", searchQuery: gTabRestrictChar + " abc"}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: gTabRestrictChar + " abc", searchQuery: gTabRestrictChar + " abc"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] } ]
});
do_log_info("tab match with not-addable pages");
yield check_autocomplete({
search: "mozilla",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla", searchQuery: "mozilla"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] } ]
});
do_log_info("tab match with not-addable pages and restriction character");
yield check_autocomplete({
search: gTabRestrictChar + " mozilla",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: gTabRestrictChar + " mozilla", searchQuery: gTabRestrictChar + " mozilla"}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: gTabRestrictChar + " mozilla", searchQuery: gTabRestrictChar + " mozilla"}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] } ]
});
do_log_info("tab match with not-addable pages and only restriction character");
yield check_autocomplete({
search: gTabRestrictChar,
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: gTabRestrictChar, searchQuery: gTabRestrictChar}), title: "MozSearch" },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks" },
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla" },
{ uri: makeActionURI("switchtab", {url: "data:text/html,test"}), title: "data:text/html,test" } ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: gTabRestrictChar, searchQuery: gTabRestrictChar}), title: "MozSearch", style: [ "action", "searchengine" ] },
{ uri: makeActionURI("switchtab", {url: "http://abc.com/"}), title: "ABC rocks", style: [ "action", "switchtab" ] },
{ uri: makeActionURI("switchtab", {url: "about:mozilla"}), title: "about:mozilla", style: [ "action", "switchtab" ] },
{ uri: makeActionURI("switchtab", {url: "data:text/html,test"}), title: "data:text/html,test", style: [ "action", "switchtab" ] } ]
});
yield cleanup();

View File

@ -7,21 +7,21 @@ add_task(function*() {
yield check_autocomplete({
search: "mozilla.org",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "http://mozilla.org/", input: "mozilla.org"}), title: "http://mozilla.org/" }, ]
matches: [ { uri: makeActionURI("visiturl", {url: "http://mozilla.org/", input: "mozilla.org"}), title: "http://mozilla.org/", style: [ "action", "visiturl" ] } ]
});
do_log_info("visit url, with protocol");
yield check_autocomplete({
search: "https://mozilla.org",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "https://mozilla.org/", input: "https://mozilla.org"}), title: "https://mozilla.org/" }, ]
matches: [ { uri: makeActionURI("visiturl", {url: "https://mozilla.org/", input: "https://mozilla.org"}), title: "https://mozilla.org/", style: [ "action", "visiturl" ] } ]
});
do_log_info("visit url, about: protocol (no host)");
yield check_autocomplete({
search: "about:config",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "about:config", input: "about:config"}), title: "about:config" }, ]
matches: [ { uri: makeActionURI("visiturl", {url: "about:config", input: "about:config"}), title: "about:config", style: [ "action", "visiturl" ] } ]
});
// This is distinct because of how we predict being able to url autofill via
@ -33,7 +33,7 @@ add_task(function*() {
yield check_autocomplete({
search: "mozilla.org/rum",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("visiturl", {url: "http://mozilla.org/rum", input: "mozilla.org/rum"}), title: "http://mozilla.org/rum" }, ]
matches: [ { uri: makeActionURI("visiturl", {url: "http://mozilla.org/rum", input: "mozilla.org/rum"}), title: "http://mozilla.org/rum", style: [ "action", "visiturl" ] } ]
});
// And hosts with no dot in them are special, due to requiring whitelisting.
@ -48,6 +48,6 @@ add_task(function*() {
yield check_autocomplete({
search: "mozilla/rum",
searchParam: "enable-actions",
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla/rum", searchQuery: "mozilla/rum"}), title: "MozSearch" }, ]
matches: [ { uri: makeActionURI("searchengine", {engineName: "MozSearch", input: "mozilla/rum", searchQuery: "mozilla/rum"}), title: "MozSearch", style: [ "action", "searchengine" ] } ]
});
});

View File

@ -52,7 +52,7 @@ add_task(function* test_escape() {
search: "match",
matches: [ { uri: uri1, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri10, title: "title1" } ]
});
@ -61,7 +61,7 @@ add_task(function* test_escape() {
search: "dont",
matches: [ { uri: uri2, title: "title1" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ] } ]
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] } ]
});
do_log_info("Match 'match' at the beginning or after / or on a CamelCase");
@ -69,8 +69,8 @@ add_task(function* test_escape() {
search: "2",
matches: [ { uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ] } ]
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] } ]
});
do_log_info("Match 't' at the beginning or after /");
@ -80,8 +80,8 @@ add_task(function* test_escape() {
{ uri: uri2, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] },
{ uri: uri10, title: "title1" } ]
});
@ -98,8 +98,8 @@ add_task(function* test_escape() {
{ uri: uri2, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] },
{ uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" },
{ uri: uri8, title: katakana.join("") },
{ uri: uri9, title: ideograph.join("") },
@ -164,8 +164,8 @@ add_task(function* test_escape() {
{ uri: uri2, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] },
{ uri: uri10, title: "title1" } ]
});