Bug 750454 - Fix FUEL leaks. Part 7: Test fixes. r=mak

--HG--
extra : rebase_source : 0201c4b3ea9f621cf9ee49402683ee2ce95b017b
This commit is contained in:
Justin Lebar 2012-06-05 20:05:50 -04:00
Родитель 3edc398a35
Коммит fa5fbca01c
2 изменённых файлов: 34 добавлений и 4 удалений

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

@ -148,9 +148,6 @@ function test() {
pref.locked = false; pref.locked = false;
ok(!pref.locked, "A single preference is unlocked."); ok(!pref.locked, "A single preference is unlocked.");
// Preference events tests disabled until bug 533290 is fixed
return;
// check for change event when setting a value // check for change event when setting a value
waitForExplicitFinish(); waitForExplicitFinish();
Application.prefs.events.addListener("change", onPrefChange); Application.prefs.events.addListener("change", onPrefChange);
@ -177,4 +174,6 @@ function onPrefChange2(evt) {
finish(); finish();
} }
function onPrefChangeDummy(evt) { } function onPrefChangeDummy(evt) {
ok(false, "onPrefChangeDummy shouldn't be invoked!");
}

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

@ -1,5 +1,6 @@
var gLastFolderAction = ""; var gLastFolderAction = "";
var gLastBookmarkAction = ""; var gLastBookmarkAction = "";
var gLastRootAction = "";
function url(spec) { function url(spec) {
return Services.io.newURI(spec, null, null); return Services.io.newURI(spec, null, null);
@ -187,6 +188,24 @@ function test() {
testFolderA.parent = testFolderB; testFolderA.parent = testFolderB;
is(testFolderA.parent.title, "folder-b", "Checking for new parent after moving folder"); is(testFolderA.parent.title, "folder-b", "Checking for new parent after moving folder");
is(gLastFolderAction, "move", "Checking for event handler after moving folder"); is(gLastFolderAction, "move", "Checking for event handler after moving folder");
// test events on the root
root.events.addListener("add", onRootAdd);
root.events.addListener("remove", onRootRemove);
root.events.addListener("change", onRootChange);
var testFolderC = root.addFolder("folder-c");
is(gLastRootAction, "add");
root.events.removeListener("add", onRootAdd);
gLastRootAction = "";
var testFolderD = root.addFolder("folder-d");
is(gLastRootAction, "");
testFolderC.remove();
is(gLastRootAction, "remove");
testFolderD.description = "Foo";
is(gLastRootAction, "bookmarkProperties/description");
} }
function onFolderChange(evt) { function onFolderChange(evt) {
@ -220,3 +239,15 @@ function onBookmarkRemove(evt) {
function onBookmarkMove(evt) { function onBookmarkMove(evt) {
gLastBookmarkAction = evt.type; gLastBookmarkAction = evt.type;
} }
function onRootAdd(evt) {
gLastRootAction = evt.type;
}
function onRootRemove(evt) {
gLastRootAction = evt.type;
}
function onRootChange(evt) {
gLastRootAction = evt.data;
}