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
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">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
20 SimpleTest.waitForExplicitFinish();
22 var startPaintCount = window.mozPaintCount;
23 ok(true, "Got to initial paint count: " + startPaintCount);
24 var color = 0;
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 }
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 }
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 }
53 color = (color + 1) % 256;
54 document.body.style.backgroundColor = "rgb(" + color + "," + color + "," + color + ")";
55 setTimeout(doBackgroundFlicker, 0);
56 }
58 </script>
59 </pre>
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>
67 </body>
68 </html>