fune/toolkit/components/thumbnails/test/browser_thumbnails_bg_no_duplicates.js
Mike Conley fac08e5f9c Bug 1591495 - Update thumbnail tests to use more modern primitives, like add_task. r=Gijs
Depends on D50851

Differential Revision: https://phabricator.services.mozilla.com/D50852

--HG--
extra : moz-landing-system : lando
2019-11-01 22:55:11 +00:00

24 lines
770 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(async function thumbnails_bg_no_duplicates() {
let url = "http://example.com/1";
ok(!thumbnailExists(url), "Thumbnail file should not already exist.");
let firstCapture = bgCapture(url, {
onDone: doneUrl => {
is(doneUrl, url, "called back with correct url");
ok(thumbnailExists(url), "Thumbnail file should now exist.");
removeThumbnail(url);
},
});
let secondCapture = bgCapture(url, {
onDone: doneUrl => {
is(doneUrl, url, "called back with correct url");
ok(!thumbnailExists(url), "Thumbnail file should still be deleted.");
},
});
await Promise.all([firstCapture, secondCapture]);
});