|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Tests for mozPaintCount</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="enableTestPlugin.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
8 </head> |
|
9 <body onload="doBackgroundFlicker()"> |
|
10 <p id="display"> |
|
11 <embed type="application/x-test" width="100" height="100" id="p" |
|
12 drawmode="solid" color="FF00FF00"></embed> |
|
13 </p> |
|
14 <div id="content" style="display: none"> |
|
15 |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script class="testbody" type="text/javascript"> |
|
19 |
|
20 SimpleTest.waitForExplicitFinish(); |
|
21 |
|
22 var startPaintCount = window.mozPaintCount; |
|
23 ok(true, "Got to initial paint count: " + startPaintCount); |
|
24 var color = 0; |
|
25 |
|
26 function doPluginFlicker() { |
|
27 ok(true, "Plugin color iteration " + color + ", paint count: " + window.mozPaintCount); |
|
28 if (window.mozPaintCount - startPaintCount > 20) { |
|
29 ok(true, "Got enough paints from plugin color changes"); |
|
30 SimpleTest.finish(); |
|
31 return; |
|
32 } |
|
33 |
|
34 color = (color + 1) % 256; |
|
35 var str = color.toString(16); |
|
36 if (str.length < 2) { |
|
37 str = "0" + str; |
|
38 } |
|
39 str = "FF" + str + str + str; |
|
40 document.getElementById("p").setColor(str); |
|
41 setTimeout(doPluginFlicker, 0); |
|
42 } |
|
43 |
|
44 function doBackgroundFlicker() { |
|
45 ok(true, "Background color iteration " + color + ", paint count: " + window.mozPaintCount); |
|
46 if (window.mozPaintCount - startPaintCount > 20) { |
|
47 ok(true, "Got enough paints from background color changes"); |
|
48 startPaintCount = window.mozPaintCount; |
|
49 doPluginFlicker(); |
|
50 return; |
|
51 } |
|
52 |
|
53 color = (color + 1) % 256; |
|
54 document.body.style.backgroundColor = "rgb(" + color + "," + color + "," + color + ")"; |
|
55 setTimeout(doBackgroundFlicker, 0); |
|
56 } |
|
57 |
|
58 </script> |
|
59 </pre> |
|
60 |
|
61 <div style="height:4000px"></div> |
|
62 <a id="first" href="http://www.mozilla.org/">first<br>link</a> |
|
63 <a id="second" href="http://www.mozilla.org/">second link</a> |
|
64 <a id="third" href="http://www.mozilla.org/">third<br>link</a> |
|
65 <div style="height:4000px"></div> |
|
66 |
|
67 </body> |
|
68 </html> |
|
69 |