diff -r 000000000000 -r 6474c204b198 browser/metro/base/tests/mochitest/helpers/HistoryHelper.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/metro/base/tests/mochitest/helpers/HistoryHelper.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,94 @@ +// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*- +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +var HistoryTestHelper = { + _originalNavHistoryService: null, + _startView: null, + MockNavHistoryService: { + getNewQueryOptions: function () { + return {}; + }, + getNewQuery: function () { + return { + setFolders: function(){} + }; + }, + executeQuery: function () { + return { + root: { + get childCount() { + return Object.keys(HistoryTestHelper._nodes).length; + }, + + getChild: function (aIndex) HistoryTestHelper._nodes[Object.keys(HistoryTestHelper._nodes)[aIndex]] + } + } + } + }, + + _originalHistoryService: null, + MockHistoryService: { + removePage: function (aURI) { + delete HistoryTestHelper._nodes[aURI.spec]; + + // Simulate observer notification + HistoryTestHelper._startView.onDeleteURI(aURI); + }, + }, + + Node: function (aTitle, aURISpec) { + this.title = aTitle; + this.uri = aURISpec; + this.pinned = true + }, + + _nodes: null, + createNodes: function (aMany) { + this._nodes = {}; + for (let i=0; i