summaryrefslogtreecommitdiffstats
path: root/services/sync/tests/unit/test_bookmark_livemarks.js
diff options
context:
space:
mode:
Diffstat (limited to 'services/sync/tests/unit/test_bookmark_livemarks.js')
-rw-r--r--services/sync/tests/unit/test_bookmark_livemarks.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/services/sync/tests/unit/test_bookmark_livemarks.js b/services/sync/tests/unit/test_bookmark_livemarks.js
index 8adde76d8..d7cda091b 100644
--- a/services/sync/tests/unit/test_bookmark_livemarks.js
+++ b/services/sync/tests/unit/test_bookmark_livemarks.js
@@ -12,11 +12,11 @@ Cu.import("resource://testing-common/services/common/utils.js");
const DESCRIPTION_ANNO = "bookmarkProperties/description";
-var engine = Service.engineManager.get("bookmarks");
-var store = engine._store;
+let engine = Service.engineManager.get("bookmarks");
+let store = engine._store;
// Record borrowed from Bug 631361.
-var record631361 = {
+let record631361 = {
id: "M5bwUKK8hPyF",
index: 150,
modified: 1296768176.49,
@@ -103,11 +103,20 @@ add_test(function test_livemark_descriptions() {
add_test(function test_livemark_invalid() {
_("Livemarks considered invalid by nsLivemarkService are skipped.");
+ _("Parent is 0, which is invalid. Will be set to unfiled.");
+ let noParentRec = makeLivemark(record631361.payload, true);
+ noParentRec._parent = 0;
+ store.create(noParentRec);
+ let recID = store.idForGUID(noParentRec.id, true);
+ do_check_true(recID > 0);
+ do_check_eq(PlacesUtils.bookmarks.getFolderIdForItem(recID), PlacesUtils.bookmarks.unfiledBookmarksFolder);
+
_("Parent is unknown. Will be set to unfiled.");
let lateParentRec = makeLivemark(record631361.payload, true);
let parentGUID = Utils.makeGUID();
lateParentRec.parentid = parentGUID;
- do_check_eq(-1, store.idForGUID(parentGUID));
+ lateParentRec._parent = store.idForGUID(parentGUID); // Usually done by applyIncoming.
+ do_check_eq(-1, lateParentRec._parent);
store.create(lateParentRec);
recID = store.idForGUID(lateParentRec.id, true);
@@ -124,7 +133,7 @@ add_test(function test_livemark_invalid() {
_("Parent is a Livemark. Will be skipped.");
let lmParentRec = makeLivemark(record631361.payload, true);
- lmParentRec.parentid = store.GUIDForId(recID);
+ lmParentRec._parent = recID;
store.create(lmParentRec);
// No exception, but no creation occurs.
do_check_eq(-1, store.idForGUID(lmParentRec.id, true));