toolkit/components/thumbnails/test/browser_thumbnails_bg_no_cookies_sent.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function runTests() {
     5   // Visit the test page in the browser and tell it to set a cookie.
     6   let url = bgTestPageURL({ setGreenCookie: true });
     7   let tab = gBrowser.loadOneTab(url, { inBackground: false });
     8   let browser = tab.linkedBrowser;
     9   yield whenLoaded(browser);
    11   // The root element of the page shouldn't be green yet.
    12   let greenStr = "rgb(0, 255, 0)";
    13   isnot(browser.contentDocument.documentElement.style.backgroundColor,
    14         greenStr,
    15         "The page shouldn't be green yet.");
    17   // Cookie should be set now.  Reload the page to verify.  Its root element
    18   // will be green if the cookie's set.
    19   browser.reload();
    20   yield whenLoaded(browser);
    21   is(browser.contentDocument.documentElement.style.backgroundColor,
    22      greenStr,
    23      "The page should be green now.");
    25   // Capture the page.  Get the image data of the capture and verify it's not
    26   // green.  (Checking only the first pixel suffices.)
    27   yield bgCapture(url);
    28   ok(thumbnailExists(url), "Thumbnail file should exist after capture.");
    30   retrieveImageDataForURL(url, function ([r, g, b]) {
    31     isnot([r, g, b].toString(), [0, 255, 0].toString(),
    32           "The captured page should not be green.");
    33     gBrowser.removeTab(tab);
    34     removeThumbnail(url);
    35     next();
    36   });
    37   yield true;
    38 }

mercurial