browser/base/content/test/general/browser_bug517902.js

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:25d5928e61ee
1 /* Make sure that "View Image Info" loads the correct image data */
2
3 function test() {
4 waitForExplicitFinish();
5
6 gBrowser.selectedTab = gBrowser.addTab();
7
8 gBrowser.selectedBrowser.addEventListener("load", function () {
9 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
10
11 var doc = gBrowser.contentDocument;
12 var testImg = doc.getElementById("test-image");
13 var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg);
14
15 pageInfo.addEventListener("load", function () {
16 pageInfo.removeEventListener("load", arguments.callee, true);
17 pageInfo.onImagePreviewShown.push(function () {
18 executeSoon(function () {
19 var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
20
21 is(pageInfoImg.src, testImg.src, "selected image has the correct source");
22 is(pageInfoImg.width, testImg.width, "selected image has the correct width");
23 is(pageInfoImg.height, testImg.height, "selected image has the correct height");
24
25 pageInfo.close();
26 gBrowser.removeCurrentTab();
27 finish();
28 });
29 });
30 }, true);
31 }, true);
32
33 content.location =
34 "data:text/html," +
35 "<style type='text/css'>%23test-image,%23not-test-image {background-image: url('about:logo?c');}</style>" +
36 "<img src='about:logo?b' height=300 width=350 alt=2 id='not-test-image'>" +
37 "<img src='about:logo?b' height=300 width=350 alt=2>" +
38 "<img src='about:logo?a' height=200 width=250>" +
39 "<img src='about:logo?b' height=200 width=250 alt=1>" +
40 "<img src='about:logo?b' height=100 width=150 alt=2 id='test-image'>";
41 }

mercurial