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: try { michael@0: var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"]. michael@0: getService(Ci.nsINavHistoryService); michael@0: var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. michael@0: getService(Ci.nsINavBookmarksService); michael@0: } catch(ex) { michael@0: do_throw("Unable to initialize Places services"); michael@0: } michael@0: michael@0: // create a query bookmark michael@0: var queryId = bmsvc.insertBookmark(bmsvc.toolbarFolder, uri("place:"), michael@0: 0 /* first item */, "test query"); michael@0: michael@0: // query for that query michael@0: var options = histsvc.getNewQueryOptions(); michael@0: var query = histsvc.getNewQuery(); michael@0: query.setFolders([bmsvc.toolbarFolder], 1); michael@0: var result = histsvc.executeQuery(query, options); michael@0: var root = result.root; michael@0: root.containerOpen = true; michael@0: var queryNode = root.getChild(0); michael@0: do_check_eq(queryNode.title, "test query"); michael@0: michael@0: // change the title michael@0: bmsvc.setItemTitle(queryId, "foo"); michael@0: michael@0: // confirm the node was updated michael@0: do_check_eq(queryNode.title, "foo"); michael@0: michael@0: root.containerOpen = false; michael@0: }