michael@0: // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: var BookmarksTestHelper = { michael@0: _originalNavHistoryService: null, michael@0: _startView: null, michael@0: MockNavHistoryService: { michael@0: getNewQueryOptions: function () { michael@0: return {}; michael@0: }, michael@0: getNewQuery: function () { michael@0: return { michael@0: setFolders: function(){} michael@0: }; michael@0: }, michael@0: executeQuery: function () { michael@0: return { michael@0: root: { michael@0: get childCount() { michael@0: return Object.keys(BookmarksTestHelper._nodes).length; michael@0: }, michael@0: michael@0: getChild: function (aIndex) BookmarksTestHelper._nodes[Object.keys(BookmarksTestHelper._nodes)[aIndex]] michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: michael@0: _originalBookmarkService: null, michael@0: MockBookmarkService: { michael@0: getItemIndex: function (aIndex) aIndex, michael@0: getBookmarkURI: function (aId) BookmarksTestHelper._nodes[aId].uri, michael@0: getItemTitle: function (aId) BookmarksTestHelper._nodes[aId].title, michael@0: removeItem: function (aId) { michael@0: delete BookmarksTestHelper._nodes[aId]; michael@0: michael@0: // Simulate observer notification michael@0: BookmarksTestHelper._startView._changes.onItemRemoved(aId, BookmarksTestHelper._startView._root); michael@0: }, michael@0: }, michael@0: michael@0: Node: function (aTitle, aId) { michael@0: this.type = this.RESULT_TYPE_URI = 0; michael@0: this.title = aTitle; michael@0: this.itemId = aId; michael@0: this.uri = "http://" + aTitle + ".com.br"; michael@0: this.pinned = true michael@0: }, michael@0: michael@0: _nodes: null, michael@0: createNodes: function (aMany) { michael@0: this._nodes = {}; michael@0: for (let i=0; i