b=518506 test no unnecessary invalidation of plugins with gtk2 (mochitest version)
authorKarl Tomlinson <karlt+@karlt.net>
Mon, 14 Dec 2009 15:44:05 +1300
changeset 35701 808b422d1274118e540fe15616e23a202aa3bd6f
parent 35700 1f0cfbdf428aa52fdb27dbef9061f2af486c73d1
child 35702 a26df386758fae109bd9244a687da86e31e417e1
push id10685
push userktomlinson@mozilla.com
push dateMon, 14 Dec 2009 02:45:16 +0000
treeherdermozilla-central@808b422d1274 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs518506
milestone1.9.3a1pre
b=518506 test no unnecessary invalidation of plugins with gtk2 (mochitest version)
widget/tests/test_plugin_scroll_invalidation.html
--- a/widget/tests/test_plugin_scroll_invalidation.html
+++ b/widget/tests/test_plugin_scroll_invalidation.html
@@ -1,51 +1,43 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for plugin child widgets not being invalidated by scrolling</title>
-  <script type="text/javascript"
-          src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="text/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+  <script type="text/javascript" src="/MochiKit/packed.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body onload="initialize()">
 <p id="display">
   <iframe id="i" src="plugin_scroll_invalidation.html"
    width="50" height="50" scrolling="no"></iframe>
 </p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 </pre>
 
-<script class="testbody" type="application/javascript">
+<script type="application/javascript">
 SimpleTest.waitForExplicitFinish();
 
 var scrolling;
 var scrolling_plugins = [];
 var paint_waiter;
 var last_paint_count;
 
 function initialize() {
   scrolling = document.getElementById("i").contentWindow;
   scrolling_plugins = scrolling.document.querySelectorAll("embed.scrolling");
   paint_waiter = scrolling.document.getElementById("paint-waiter");
 
-  // Plugins are not instantiated until after reflow
-  waitForPlugin(startTest);
-}
+  scrolling.scrollTo(50, 45);
 
-function startTest() {
-  scrolling.scrollTo(50, 45);
   is(paint_waiter.getPaintCount(), 0, "zero-sized plugin not painted");
-
   waitForPaint(scrollAround);
 }
 
 function scrollAround() {
   var paints = getPaintCounts();
 
   for (var i = 0; i < paints.length; ++i) {
     isnot(paints[i], 0, "embed " + scrolling_plugins[i].id + " is painted"); 
@@ -67,24 +59,16 @@ function scrollAround() {
   waitForPaint(done);
 }
 
 function done() {
   is(sum(getPaintCounts()), last_paint_count, "no paint on scroll");
   SimpleTest.finish();  
 }
 
-function waitForPlugin(func) {
-  if (paint_waiter.getPaintCount) {
-    func();
-    return;
-  }
-  setTimeout(function() { waitForPlugin(func); }, 0);
-}
-
 function waitForPaint(func) {
   paint_waiter.last_paint_count = paint_waiter.getPaintCount();
   paint_waiter.style.left = scrolling.scrollX + "px";
   paint_waiter.style.top = scrolling.scrollY + "px";
   paint_waiter.style.width = "1px";
   paint_waiter.style.height = "1px";
   waitForPaintHelper(func);
 }