layout/base/tests/test_mozPaintCount.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial