Bug 585190 - Fix tracker tests on m-c [r=mconnor]

Ensure that the bookmark tracker test starts out with a clean slate.

Svc.History.removeAllPages(), as called by the history tracker test during clean up, needs the "UHist" alias registered, which isn't available by default in xpcshell.
This commit is contained in:
Philipp von Weitershausen 2010-08-06 23:25:59 +02:00
Родитель 6cefdc1625
Коммит ac08f9116f
2 изменённых файлов: 28 добавлений и 2 удалений

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

@ -2,8 +2,11 @@ Cu.import("resource://services-sync/engines/bookmarks.js");
Cu.import("resource://services-sync/util.js");
function run_test() {
let engine = new BookmarksEngine();
engine._store.wipe();
_("Verify we've got an empty tracker to work with.");
let tracker = new BookmarksEngine()._tracker;
let tracker = engine._tracker;
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
let folder = Svc.Bookmark.createFolder(Svc.Bookmark.bookmarksMenuFolder,
@ -43,6 +46,6 @@ function run_test() {
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
} finally {
_("Clean up.");
Svc.Bookmark.removeItem(folder);
engine._store.wipe();
}
}

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

@ -1,6 +1,29 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://services-sync/engines/history.js");
Cu.import("resource://services-sync/util.js");
// See toolkit/components/places/tests/head_common.js
const NS_APP_HISTORY_50_FILE = "UHist";
const dirsvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIDirectoryService);
// Add our own dirprovider for old history.dat.
let provider = {
getFile: function(prop, persistent) {
persistent.value = true;
if (prop == NS_APP_HISTORY_50_FILE) {
let histFile = dirsvc.get("ProfD", Ci.nsIFile);
histFile.append("history.dat");
return histFile;
}
throw Cr.NS_ERROR_FAILURE;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider])
};
dirsvc.registerProvider(provider);
function run_test() {
_("Verify we've got an empty tracker to work with.");
let tracker = new HistoryEngine()._tracker;