1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/test/test_invalidate_during_plugin_paint.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test handling plugins invalidating during paint</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="enableTestPlugin.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 + <style> 1.12 + embed { width:200px; height:200px; display:block; } 1.13 + </style> 1.14 +</head> 1.15 +<body> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: block"> 1.18 + <embed id="p1" type="application/x-test" drawmode="solid" color="80808080"></embed> 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script class="testbody" type="text/javascript"> 1.22 +var p1 = document.getElementById("p1"); 1.23 +var initialPaintCount; 1.24 + 1.25 +function checkEnded() { 1.26 + var paints = p1.getPaintCount() - initialPaintCount; 1.27 + if (paints > 20) { 1.28 + ok(true, "Got " + paints + " paints"); 1.29 + SimpleTest.finish(); 1.30 + return; 1.31 + } 1.32 + 1.33 + setTimeout(checkEnded, 30); 1.34 +} 1.35 + 1.36 +function doTest() { 1.37 + initialPaintCount = p1.getPaintCount(); 1.38 + 1.39 + // Tell the plugin to invalidate every time it paints 1.40 + p1.setInvalidateDuringPaint(true); 1.41 + // Trigger an invalidation to get painting started 1.42 + p1.setColor("FFFFFFFF"); 1.43 + // Now we should have an infinite cycle of painting and invalidations. 1.44 + 1.45 + // Poll for more than 20 paints to happen. 1.46 + checkEnded(); 1.47 +} 1.48 + 1.49 +// Need to run 'doTest' after painting is unsuppressed, or we'll set clip 1.50 +// regions to empty. 1.51 +addLoadEvent(doTest); 1.52 +SimpleTest.waitForExplicitFinish(); 1.53 + 1.54 +</script> 1.55 +</pre> 1.56 +</body> 1.57 +</html>