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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Test that asking for isLivemark in a annotationChanged notification
     5 // correctly returns true.
     6 function run_test()
     7 {
     8   do_test_pending();
    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     },
    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