diff -r 000000000000 -r 6474c204b198 toolkit/components/places/tests/unit/test_bug636917_isLivemark.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,40 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that asking for isLivemark in a annotationChanged notification +// correctly returns true. +function run_test() +{ + do_test_pending(); + + let annoObserver = { + onItemAnnotationSet: + function AO_onItemAnnotationSet(aItemId, aAnnotationName) + { + if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) { + PlacesUtils.annotations.removeObserver(this); + PlacesUtils.livemarks.getLivemark({ id: aItemId }) + .then(aLivemark => { + PlacesUtils.bookmarks.removeItem(aItemId); + do_test_finished(); + }, do_throw); + } + }, + + onItemAnnotationRemoved: function () {}, + onPageAnnotationSet: function() {}, + onPageAnnotationRemoved: function() {}, + QueryInterface: XPCOMUtils.generateQI([ + Ci.nsIAnnotationObserver + ]), + } + PlacesUtils.annotations.addObserver(annoObserver, false); + PlacesUtils.livemarks.addLivemark( + { title: "livemark title" + , parentId: PlacesUtils.unfiledBookmarksFolderId + , index: PlacesUtils.bookmarks.DEFAULT_INDEX + , siteURI: uri("http://example.com/") + , feedURI: uri("http://example.com/rdf") + } + ).then(null, do_throw); +}