Bug 731663. (Bv1a-FF) test_bookmarks_html.js: Fix nits, Add/Use do_print(), Improve documentation. r=mak77.

This commit is contained in:
Serge Gautherie 2012-03-05 19:44:47 +01:00
Родитель ba67b4520e
Коммит 311edbbdd6
1 изменённых файлов: 14 добавлений и 12 удалений

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

@ -57,8 +57,8 @@ let test_bookmarks = {
{ title: "About Us", { title: "About Us",
url: "http://en-us.www.mozilla.com/en-US/about/", url: "http://en-us.www.mozilla.com/en-US/about/",
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==" icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="
}, }
], ]
}, },
{ title: "test", { title: "test",
description: "folder test comment", description: "folder test comment",
@ -72,10 +72,10 @@ let test_bookmarks = {
keyword: "test", keyword: "test",
sidebar: true, sidebar: true,
postData: "hidden1%3Dbar&text1%3D%25s", postData: "hidden1%3Dbar&text1%3D%25s",
charset: "ISO-8859-1", charset: "ISO-8859-1"
}, }
] ]
}, }
], ],
toolbar: [ toolbar: [
{ title: "Getting Started", { title: "Getting Started",
@ -84,14 +84,14 @@ let test_bookmarks = {
}, },
{ title: "Latest Headlines", { title: "Latest Headlines",
url: "http://en-us.fxfeeds.mozilla.com/en-US/firefox/livebookmarks/", url: "http://en-us.fxfeeds.mozilla.com/en-US/firefox/livebookmarks/",
feedUrl: "http://en-us.fxfeeds.mozilla.com/en-US/firefox/headlines.xml", feedUrl: "http://en-us.fxfeeds.mozilla.com/en-US/firefox/headlines.xml"
} }
], ],
unfiled: [ unfiled: [
{ title: "Example.tld", { title: "Example.tld",
url: "http://example.tld/", url: "http://example.tld/"
}, }
], ]
}; };
// Pre-Places bookmarks.html file pointer. // Pre-Places bookmarks.html file pointer.
@ -303,6 +303,8 @@ add_test(function test_import_ontop()
function testImportedBookmarks() function testImportedBookmarks()
{ {
for (let group in test_bookmarks) { for (let group in test_bookmarks) {
do_print("[testImportedBookmarks()] Checking group '" + group + "'");
let root; let root;
switch (group) { switch (group) {
case "menu": case "menu":
@ -335,6 +337,7 @@ function testImportedBookmarksToFolder(aFolder)
for (let i = 0; i < root.childCount; i++) { for (let i = 0; i < root.childCount; i++) {
let child = root.getChild(i); let child = root.getChild(i);
// This check depends on all "menu" bookmarks being listed first in the imported file :-|
if (i < rootFolderCount) { if (i < rootFolderCount) {
checkItem(test_bookmarks.menu[i], child); checkItem(test_bookmarks.menu[i], child);
} }
@ -343,9 +346,8 @@ function testImportedBookmarksToFolder(aFolder)
let group = /Toolbar/.test(container.title) ? test_bookmarks.toolbar let group = /Toolbar/.test(container.title) ? test_bookmarks.toolbar
: test_bookmarks.unfiled; : test_bookmarks.unfiled;
container.containerOpen = true; container.containerOpen = true;
print(container.title); do_print("[testImportedBookmarksToFolder()] Checking container '" + container.title + "'");
for (let t = 0; t < container.childCount; t++) { for (let t = 0; t < container.childCount; t++) {
print(group[t].title + " " + container.getChild(t).title);
checkItem(group[t], container.getChild(t)); checkItem(group[t], container.getChild(t));
} }
container.containerOpen = false; container.containerOpen = false;