|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
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); |
|
10 |
|
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."); |
|
16 |
|
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."); |
|
24 |
|
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."); |
|
29 |
|
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 } |