diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /services/sync/tests/unit/test_bookmark_decline_undecline.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'services/sync/tests/unit/test_bookmark_decline_undecline.js')
-rw-r--r-- | services/sync/tests/unit/test_bookmark_decline_undecline.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/services/sync/tests/unit/test_bookmark_decline_undecline.js b/services/sync/tests/unit/test_bookmark_decline_undecline.js new file mode 100644 index 0000000000..12139dd163 --- /dev/null +++ b/services/sync/tests/unit/test_bookmark_decline_undecline.js @@ -0,0 +1,48 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const { Service } = ChromeUtils.importESModule( + "resource://services-sync/service.sys.mjs" +); + +// A stored reference to the collection won't be valid after disabling. +function getBookmarkWBO(server, guid) { + let coll = server.user("foo").collection("bookmarks"); + if (!coll) { + return null; + } + return coll.wbo(guid); +} + +add_task(async function test_decline_undecline() { + let engine = Service.engineManager.get("bookmarks"); + let server = await serverForFoo(engine); + await SyncTestingInfrastructure(server); + + try { + let { guid: bzGuid } = await PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.menuGuid, + url: "https://bugzilla.mozilla.org", + index: PlacesUtils.bookmarks.DEFAULT_INDEX, + title: "bugzilla", + }); + + ok(!getBookmarkWBO(server, bzGuid), "Shouldn't have been uploaded yet"); + await Service.sync(); + ok(getBookmarkWBO(server, bzGuid), "Should be present on server"); + + engine.enabled = false; + await Service.sync(); + ok( + !getBookmarkWBO(server, bzGuid), + "Shouldn't be present on server anymore" + ); + + engine.enabled = true; + await Service.sync(); + ok(getBookmarkWBO(server, bzGuid), "Should be present on server again"); + } finally { + await PlacesSyncUtils.bookmarks.reset(); + await promiseStopServer(server); + } +}); |