зеркало из https://github.com/mozilla/gecko-dev.git
fix to test for bug 381365
This commit is contained in:
Родитель
63f0ed56e4
Коммит
9782ee5ce9
|
@ -57,14 +57,21 @@ function test() {
|
|||
|
||||
var toolbarId = PlacesUtils.toolbarFolderId;
|
||||
var toolbarNode = PlacesUtils.getFolderContents(toolbarId).root;
|
||||
is(toolbarNode.childCount, 0, "confirm toolbar is empty");
|
||||
|
||||
var oldCount = toolbarNode.childCount;
|
||||
var testRootId = PlacesUtils.bookmarks.createFolder(toolbarId, "test root", -1);
|
||||
is(toolbarNode.childCount, oldCount+1, "confirm test root node is a container, and is empty");
|
||||
var testRootNode = toolbarNode.getChild(toolbarNode.childCount-1);
|
||||
testRootNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
testRootNode.containerOpen = true;
|
||||
is(testRootNode.childCount, 0, "confirm test root node is a container, and is empty");
|
||||
|
||||
// create folder A, fill it, validate it's contents
|
||||
var folderAId = PlacesUtils.bookmarks.createFolder(toolbarId, "A", -1);
|
||||
var folderAId = PlacesUtils.bookmarks.createFolder(testRootId, "A", -1);
|
||||
populate(folderAId);
|
||||
var folderANode = PlacesUtils.getFolderContents(folderAId).root;
|
||||
validate(folderANode);
|
||||
is(toolbarNode.childCount, 1, "create test folder");
|
||||
is(testRootNode.childCount, 1, "create test folder");
|
||||
|
||||
// copy it, using the front-end helper functions
|
||||
var serializedNode = PlacesUtils.wrapNode(folderANode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER);
|
||||
|
@ -73,26 +80,26 @@ function test() {
|
|||
ok(rawNode.type, "confirm json node");
|
||||
var transaction = PlacesUIUtils.makeTransaction(rawNode,
|
||||
PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER,
|
||||
toolbarId,
|
||||
testRootId,
|
||||
-1,
|
||||
true);
|
||||
ok(transaction, "create transaction");
|
||||
PlacesUIUtils.ptm.doTransaction(transaction);
|
||||
// confirm copy
|
||||
is(toolbarNode.childCount, 2, "create test folder via copy");
|
||||
is(testRootNode.childCount, 2, "create test folder via copy");
|
||||
|
||||
// validate the copy
|
||||
var folderBNode = toolbarNode.getChild(1);
|
||||
var folderBNode = testRootNode.getChild(1);
|
||||
validate(folderBNode);
|
||||
|
||||
// undo the transaction, confirm the removal
|
||||
PlacesUIUtils.ptm.undoTransaction();
|
||||
is(toolbarNode.childCount, 1, "confirm undo removed the copied folder");
|
||||
is(testRootNode.childCount, 1, "confirm undo removed the copied folder");
|
||||
|
||||
// redo the transaction
|
||||
PlacesUIUtils.ptm.redoTransaction();
|
||||
is(toolbarNode.childCount, 2, "confirm redo re-copied the folder");
|
||||
folderBNode = toolbarNode.getChild(1);
|
||||
is(testRootNode.childCount, 2, "confirm redo re-copied the folder");
|
||||
folderBNode = testRootNode.getChild(1);
|
||||
validate(folderBNode);
|
||||
|
||||
// clean up
|
||||
|
|
Загрузка…
Ссылка в новой задаче