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