michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function runTests() { michael@0: // Visit the test page in the browser and tell it to set a cookie. michael@0: let url = bgTestPageURL({ setGreenCookie: true }); michael@0: let tab = gBrowser.loadOneTab(url, { inBackground: false }); michael@0: let browser = tab.linkedBrowser; michael@0: yield whenLoaded(browser); michael@0: michael@0: // The root element of the page shouldn't be green yet. michael@0: let greenStr = "rgb(0, 255, 0)"; michael@0: isnot(browser.contentDocument.documentElement.style.backgroundColor, michael@0: greenStr, michael@0: "The page shouldn't be green yet."); michael@0: michael@0: // Cookie should be set now. Reload the page to verify. Its root element michael@0: // will be green if the cookie's set. michael@0: browser.reload(); michael@0: yield whenLoaded(browser); michael@0: is(browser.contentDocument.documentElement.style.backgroundColor, michael@0: greenStr, michael@0: "The page should be green now."); michael@0: michael@0: // Capture the page. Get the image data of the capture and verify it's not michael@0: // green. (Checking only the first pixel suffices.) michael@0: yield bgCapture(url); michael@0: ok(thumbnailExists(url), "Thumbnail file should exist after capture."); michael@0: michael@0: retrieveImageDataForURL(url, function ([r, g, b]) { michael@0: isnot([r, g, b].toString(), [0, 255, 0].toString(), michael@0: "The captured page should not be green."); michael@0: gBrowser.removeTab(tab); michael@0: removeThumbnail(url); michael@0: next(); michael@0: }); michael@0: yield true; michael@0: }