michael@0: /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: function run_test() { michael@0: run_next_test(); michael@0: } michael@0: michael@0: add_test(function test_resolveNullBookmarkTitles() { michael@0: let uri1 = uri("http://foo.tld/"); michael@0: let uri2 = uri("https://bar.tld/"); michael@0: michael@0: promiseAddVisits([ michael@0: { uri: uri1, title: "foo title" }, michael@0: { uri: uri2, title: "bar title" } michael@0: ]).then(function () { michael@0: PlacesUtils.bookmarks.insertBookmark(PlacesUtils.bookmarksMenuFolderId, michael@0: uri1, michael@0: PlacesUtils.bookmarks.DEFAULT_INDEX, michael@0: null); michael@0: PlacesUtils.bookmarks.insertBookmark(PlacesUtils.bookmarksMenuFolderId, michael@0: uri2, michael@0: PlacesUtils.bookmarks.DEFAULT_INDEX, michael@0: null); michael@0: michael@0: PlacesUtils.tagging.tagURI(uri1, ["tag 1"]); michael@0: PlacesUtils.tagging.tagURI(uri2, ["tag 2"]); michael@0: michael@0: let options = PlacesUtils.history.getNewQueryOptions(); michael@0: options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS; michael@0: options.resultType = options.RESULTS_AS_TAG_CONTENTS; michael@0: michael@0: let query = PlacesUtils.history.getNewQuery(); michael@0: // if we don't set a tag folder, RESULTS_AS_TAG_CONTENTS will return all michael@0: // tagged URIs michael@0: let root = PlacesUtils.history.executeQuery(query, options).root; michael@0: root.containerOpen = true; michael@0: do_check_eq(root.childCount, 2); michael@0: // actually RESULTS_AS_TAG_CONTENTS return results ordered by place_id DESC michael@0: // so they are reversed michael@0: do_check_eq(root.getChild(0).title, "bar title"); michael@0: do_check_eq(root.getChild(1).title, "foo title"); michael@0: root.containerOpen = false; michael@0: michael@0: run_next_test(); michael@0: }); michael@0: });