Bug 632408 - [SeaMonkey, Windows] mochitest-chrome: permanent "test_leaf_layers_partition_browser_window.xul | Leaf layers should form a non-overlapping partition of the browser window" failure, since landing; (Av1) Improve test code somewhat.
authorSerge Gautherie <sgautherie.bz@free.fr>
Wed, 09 Feb 2011 10:35:25 +0100
changeset 62220 8e550551c79c3c3b829e618360a9c8a66fb94ec2
parent 62219 283fe70e1eb5d8726224631a1089907e68581f57
child 62221 280e978fc6fb4c731728255a8bc9c70ded2adbea
push idunknown
push userunknown
push dateunknown
bugs632408
milestone2.0b12pre
Bug 632408 - [SeaMonkey, Windows] mochitest-chrome: permanent "test_leaf_layers_partition_browser_window.xul | Leaf layers should form a non-overlapping partition of the browser window" failure, since landing; (Av1) Improve test code somewhat. r=roc (a=test-only).
layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul
--- a/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul
+++ b/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul
@@ -11,31 +11,41 @@
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml">
   </body>
 
   <!-- test code goes here -->
   <script type="application/javascript">
   <![CDATA[
     SimpleTest.waitForExplicitFinish();
+
     // Run the test in a separate window so we get a clean browser window.
-    window.open("data:text/html,<html style='overflow:scroll'><script>opener.doTest(window)</script>",
+    window.open("data:text/html,<html style='overflow:scroll'><script>opener.doTest(window);</script>",
                 "", "scrollbars=yes,toolbar,menubar,width=500,height=500");
+
     function doTest(win) {
-      var currentCount = win.mozPaintCount;
+      var initialCount = win.mozPaintCount;
+
       function nextStep() {
-        if (win.mozPaintCount == currentCount) {
-          setTimeout(nextStep, 0, win);
+        if (win.mozPaintCount == initialCount) {
+          is(win.mozPaintCount, initialCount, "Waiting for mozPaintCount to increase.");
+          // Do not use SimpleTest.executeSoon() here: give a little more time.
+          setTimeout(nextStep, 25);
           return;
         }
-        var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
-            getInterface(Components.interfaces.nsIDOMWindowUtils).
-            QueryInterface(Components.interfaces.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH);
+
+        isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased");
+
+        var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                       .getInterface(Components.interfaces.nsIDOMWindowUtils)
+                       .QueryInterface(Components.interfaces.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH);
         ok(utils.leafLayersPartitionWindow(),
            "Leaf layers should form a non-overlapping partition of the browser window");
+
         win.close();
         SimpleTest.finish();
       }
-      setTimeout(nextStep, 0);
+
+      SimpleTest.executeSoon(nextStep);
     }
   ]]>
   </script>
 </window>