Bug 419068 - Allow tagged pages to mingle with non-tagged autocomplete results

This commit is contained in:
edward.lee@engineering.uiuc.edu 2008-02-25 16:22:09 -08:00
Родитель 2e1bf8634b
Коммит 81032bc0d8
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -43,6 +43,9 @@
* this also tests for non-empty inputs as well. Because the interactions among * this also tests for non-empty inputs as well. Because the interactions among
* *DIFFERENT* visit counts and visit dates is not well defined, this test * *DIFFERENT* visit counts and visit dates is not well defined, this test
* holds one of the two values constant when modifying the other. * holds one of the two values constant when modifying the other.
*
* Also test bug 419068 to make sure tagged pages don't necessarily have to be
* first in the results.
*/ */
var current_test = 0; var current_test = 0;
@ -142,6 +145,8 @@ function ensure_results(uris, searchTerm)
try { try {
var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService); var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
var bhist = histsvc.QueryInterface(Ci.nsIBrowserHistory); var bhist = histsvc.QueryInterface(Ci.nsIBrowserHistory);
var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
getService(Ci.nsITaggingService);
} catch(ex) { } catch(ex) {
do_throw("Could not get history service\n"); do_throw("Could not get history service\n");
} }
@ -177,24 +182,28 @@ function() {
prepTest("0: same count, different date"); prepTest("0: same count, different date");
setCountDate(uri1, c1, d1); setCountDate(uri1, c1, d1);
setCountDate(uri2, c1, d2); setCountDate(uri2, c1, d2);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri1, uri2], ""); ensure_results([uri1, uri2], "");
}, },
function() { function() {
prepTest("1: same count, different date"); prepTest("1: same count, different date");
setCountDate(uri1, c1, d2); setCountDate(uri1, c1, d2);
setCountDate(uri2, c1, d1); setCountDate(uri2, c1, d1);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri2, uri1], ""); ensure_results([uri2, uri1], "");
}, },
function() { function() {
prepTest("2: different count, same date"); prepTest("2: different count, same date");
setCountDate(uri1, c1, d1); setCountDate(uri1, c1, d1);
setCountDate(uri2, c2, d1); setCountDate(uri2, c2, d1);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri1, uri2], ""); ensure_results([uri1, uri2], "");
}, },
function() { function() {
prepTest("3: different count, same date"); prepTest("3: different count, same date");
setCountDate(uri1, c2, d1); setCountDate(uri1, c2, d1);
setCountDate(uri2, c1, d1); setCountDate(uri2, c1, d1);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri2, uri1], ""); ensure_results([uri2, uri1], "");
}, },
@ -203,24 +212,28 @@ function() {
prepTest("4: same count, different date"); prepTest("4: same count, different date");
setCountDate(uri1, c1, d1); setCountDate(uri1, c1, d1);
setCountDate(uri2, c1, d2); setCountDate(uri2, c1, d2);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri1, uri2], "site"); ensure_results([uri1, uri2], "site");
}, },
function() { function() {
prepTest("5: same count, different date"); prepTest("5: same count, different date");
setCountDate(uri1, c1, d2); setCountDate(uri1, c1, d2);
setCountDate(uri2, c1, d1); setCountDate(uri2, c1, d1);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri2, uri1], "site"); ensure_results([uri2, uri1], "site");
}, },
function() { function() {
prepTest("6: different count, same date"); prepTest("6: different count, same date");
setCountDate(uri1, c1, d1); setCountDate(uri1, c1, d1);
setCountDate(uri2, c2, d1); setCountDate(uri2, c2, d1);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri1, uri2], "site"); ensure_results([uri1, uri2], "site");
}, },
function() { function() {
prepTest("7: different count, same date"); prepTest("7: different count, same date");
setCountDate(uri1, c2, d1); setCountDate(uri1, c2, d1);
setCountDate(uri2, c1, d1); setCountDate(uri2, c1, d1);
tagssvc.tagURI(uri1, ["site"]);
ensure_results([uri2, uri1], "site"); ensure_results([uri2, uri1], "site");
} }
]; ];