toolkit/components/places/tests/unit/test_bug636917_isLivemark.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:977ef02ae1f5
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 // Test that asking for isLivemark in a annotationChanged notification
5 // correctly returns true.
6 function run_test()
7 {
8 do_test_pending();
9
10 let annoObserver = {
11 onItemAnnotationSet:
12 function AO_onItemAnnotationSet(aItemId, aAnnotationName)
13 {
14 if (aAnnotationName == PlacesUtils.LMANNO_FEEDURI) {
15 PlacesUtils.annotations.removeObserver(this);
16 PlacesUtils.livemarks.getLivemark({ id: aItemId })
17 .then(aLivemark => {
18 PlacesUtils.bookmarks.removeItem(aItemId);
19 do_test_finished();
20 }, do_throw);
21 }
22 },
23
24 onItemAnnotationRemoved: function () {},
25 onPageAnnotationSet: function() {},
26 onPageAnnotationRemoved: function() {},
27 QueryInterface: XPCOMUtils.generateQI([
28 Ci.nsIAnnotationObserver
29 ]),
30 }
31 PlacesUtils.annotations.addObserver(annoObserver, false);
32 PlacesUtils.livemarks.addLivemark(
33 { title: "livemark title"
34 , parentId: PlacesUtils.unfiledBookmarksFolderId
35 , index: PlacesUtils.bookmarks.DEFAULT_INDEX
36 , siteURI: uri("http://example.com/")
37 , feedURI: uri("http://example.com/rdf")
38 }
39 ).then(null, do_throw);
40 }

mercurial