layout/generic/test/test_invalidate_during_plugin_paint.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.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test handling plugins invalidating during paint</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   <style>
     9   embed { width:200px; height:200px; display:block; }
    10   </style>
    11 </head>
    12 <body>
    13 <p id="display"></p>
    14 <div id="content" style="display: block">
    15   <embed id="p1" type="application/x-test" drawmode="solid" color="80808080"></embed>
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    19 var p1 = document.getElementById("p1");
    20 var initialPaintCount;
    22 function checkEnded() {
    23   var paints = p1.getPaintCount() - initialPaintCount;
    24   if (paints > 20) {
    25     ok(true, "Got " + paints + " paints");
    26     SimpleTest.finish();
    27     return;
    28   }
    30   setTimeout(checkEnded, 30);  
    31 }
    33 function doTest() {
    34   initialPaintCount = p1.getPaintCount();
    36   // Tell the plugin to invalidate every time it paints
    37   p1.setInvalidateDuringPaint(true);
    38   // Trigger an invalidation to get painting started
    39   p1.setColor("FFFFFFFF");
    40   // Now we should have an infinite cycle of painting and invalidations.
    42   // Poll for more than 20 paints to happen.
    43   checkEnded();
    44 }
    46 // Need to run 'doTest' after painting is unsuppressed, or we'll set clip
    47 // regions to empty.
    48 addLoadEvent(doTest);
    49 SimpleTest.waitForExplicitFinish();
    51 </script>
    52 </pre>
    53 </body>
    54 </html>

mercurial