OLD | NEW |
1 <script type="text/javascript"> | 1 <body> |
2 | 2 <script src="index.js"></script> |
3 var TOTAL = 4; | 3 </body> |
4 var count = 0; | |
5 | |
6 function load(e) { | |
7 if (++count < TOTAL) | |
8 return; | |
9 | |
10 // Good. All the images have loaded. Now make sure they're the correct size. | |
11 var imgs = document.getElementsByTagName('img'); | |
12 for (var x = 0; x < imgs.length; x++) { | |
13 var style = getComputedStyle(imgs[x]); | |
14 var size = imgs[x].getAttribute('testsize'); | |
15 if (style.height != size || style.width != size) { | |
16 document.title = "Incorrect size on " + imgs[x].src; | |
17 return; | |
18 } | |
19 } | |
20 | |
21 // Success! | |
22 document.title = "Loaded"; | |
23 } | |
24 | |
25 function error(e) { | |
26 // We failed to load an image that should have loaded. | |
27 document.title = "Not loaded: " + e.target.src; | |
28 } | |
29 | |
30 </script> | |
31 | |
32 <!-- Tests loading a standard 128px icon. --> | |
33 <img src="chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/128/0" | |
34 testsize="128px" | |
35 onload="load(event);" | |
36 onerror="error(event);"/> | |
37 | |
38 <!-- | |
39 Tests loading a standard 48px icon with a MATCH_SMALLER. | |
40 This should not be resized to 48px. | |
41 --> | |
42 <img src="chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/48/2" | |
43 testsize="32px" | |
44 onload="load(event);" | |
45 onerror="error(event);"/> | |
46 | |
47 <!-- | |
48 Tests loading a standard 32px icon, grayscale. We assume that we | |
49 actually got a grayscale image back here. | |
50 --> | |
51 <img src="chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/32/1?grayscal
e=true" | |
52 testsize="32px" | |
53 onload="load(event);" | |
54 onerror="error(event);"/> | |
55 | |
56 <!-- | |
57 Tests loading a 16px by resizing the 32px version (MATCH_BIGGER). | |
58 This should be resized to 16px. | |
59 --> | |
60 <img src="chrome://extension-icon/gbmgkahjioeacddebbnengilkgbkhodg/16/1" | |
61 testsize="16px" | |
62 onload="load(event);" | |
63 onerror="error(event);"/> | |
OLD | NEW |