summaryrefslogtreecommitdiffstats
path: root/toolkit/components/thumbnails/test/browser_thumbnails_bg_no_duplicates.js
blob: e4b3b428493e0c2a2a4b2e9897b4e6af04f6a3e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* 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 = "https://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]);
});