summaryrefslogtreecommitdiffstats
path: root/toolkit/components/thumbnails/test/browser_thumbnails_capture_parent_process.js
blob: 67cd6a79e2d677a67cb136b02192faf0d4d60231 (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
25
26
27
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * These tests ensure that capturing a sites's thumbnail, saving it and
 * retrieving it from the cache works, specifically for a parent process.
 */
add_task(async function thumbnails_capture() {
  // Create a parent process tab with a red background.
  // We do this by creating a parent process, then we update it to be a red page,
  // before attempting to read the page colour.
  await BrowserTestUtils.withNewTab(
    {
      gBrowser,
      // about:robots seems to be an simple parent process url we can test against,
      // but any parent process url would have worked, example, about:home or about:config
      url: "about:robots",
    },
    async browser => {
      // Because about:robots is not generally a predictable testable page,
      // we update its background to something we can test against.
      browser.contentDocument.body.innerHTML = "";
      browser.contentDocument.body.style.backgroundColor = "#ff0000";
      await captureAndCheckColor(255, 0, 0, "we have a red thumbnail");
    }
  );
});