1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/tests/unit/test_bug636917_isLivemark.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +// Test that asking for isLivemark in a annotationChanged notification 1.8 +// correctly returns true. 1.9 +function run_test() 1.10 +{ 1.11 + do_test_pending(); 1.12 + 1.13 + let annoObserver = { 1.14 + onItemAnnotationSet: 1.15 + function AO_onItemAnnotationSet(aItemId, aAnnotationName) 1.16 + { 1.17 + if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) { 1.18 + PlacesUtils.annotations.removeObserver(this); 1.19 + PlacesUtils.livemarks.getLivemark({ id: aItemId }) 1.20 + .then(aLivemark => { 1.21 + PlacesUtils.bookmarks.removeItem(aItemId); 1.22 + do_test_finished(); 1.23 + }, do_throw); 1.24 + } 1.25 + }, 1.26 + 1.27 + onItemAnnotationRemoved: function () {}, 1.28 + onPageAnnotationSet: function() {}, 1.29 + onPageAnnotationRemoved: function() {}, 1.30 + QueryInterface: XPCOMUtils.generateQI([ 1.31 + Ci.nsIAnnotationObserver 1.32 + ]), 1.33 + } 1.34 + PlacesUtils.annotations.addObserver(annoObserver, false); 1.35 + PlacesUtils.livemarks.addLivemark( 1.36 + { title: "livemark title" 1.37 + , parentId: PlacesUtils.unfiledBookmarksFolderId 1.38 + , index: PlacesUtils.bookmarks.DEFAULT_INDEX 1.39 + , siteURI: uri("http://example.com/") 1.40 + , feedURI: uri("http://example.com/rdf") 1.41 + } 1.42 + ).then(null, do_throw); 1.43 +}