2010-01-11 Ojan Vafai <ojan@chromium.org>
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jan 2010 21:54:24 +0000 (21:54 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Jan 2010 21:54:24 +0000 (21:54 +0000)
        Reviewed by Simon Fraser.

        Deflake transitions and animations tests.
        https://bugs.webkit.org/show_bug.cgi?id=30029

        The transition-end-event tests all had arbitrary timeouts. Give a consistent
        timeout to all of them. Give a generous 1 second of buffer to avoid any possibility
        of flakiness. If all the transitionEnd events fire before then, the test still
        completes without waiting for the timeout.

        * animations/change-keyframes.html:
        Increase the wiggle room. It's infrequently flaky now, but it is still
        a tad bit flaky without this extra wiggle room.
        * transitions/repeated-firing-background-color.html:
        Remove a gratuitous setTimeout.
        * transitions/transition-end-event-all-properties.html:
        * transitions/transition-end-event-attributes.html:
        * transitions/transition-end-event-container.html:
        * transitions/transition-end-event-helpers.js:
        (runTransitionTest.startTest):
        (runTransitionTest):
        * transitions/transition-end-event-left.html:
        * transitions/transition-end-event-multiple-01.html:
        * transitions/transition-end-event-multiple-02.html:
        * transitions/transition-end-event-multiple-03.html:
        * transitions/transition-end-event-multiple-04.html:
        * transitions/transition-end-event-nested.html:
        * transitions/transition-end-event-set-none.html:
        * transitions/transition-end-event-transform.html:
        * transitions/transition-end-event-window.html:
        * transitions/zero-duration-with-non-zero-delay-end.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@53097 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/change-keyframes.html
LayoutTests/transitions/repeated-firing-background-color.html
LayoutTests/transitions/transition-end-event-all-properties.html
LayoutTests/transitions/transition-end-event-attributes.html
LayoutTests/transitions/transition-end-event-container.html
LayoutTests/transitions/transition-end-event-helpers.js
LayoutTests/transitions/transition-end-event-left.html
LayoutTests/transitions/transition-end-event-multiple-01.html
LayoutTests/transitions/transition-end-event-multiple-02.html
LayoutTests/transitions/transition-end-event-multiple-03.html
LayoutTests/transitions/transition-end-event-multiple-04.html
LayoutTests/transitions/transition-end-event-nested.html
LayoutTests/transitions/transition-end-event-set-none.html
LayoutTests/transitions/transition-end-event-transform.html
LayoutTests/transitions/transition-end-event-window.html
LayoutTests/transitions/zero-duration-with-non-zero-delay-end.html

index 4459086..0b4c6a0 100644 (file)
@@ -1,3 +1,37 @@
+2010-01-11  Ojan Vafai  <ojan@chromium.org>
+
+        Reviewed by Simon Fraser.
+
+        Deflake transitions and animations tests.
+        https://bugs.webkit.org/show_bug.cgi?id=30029
+        
+        The transition-end-event tests all had arbitrary timeouts. Give a consistent
+        timeout to all of them. Give a generous 1 second of buffer to avoid any possibility
+        of flakiness. If all the transitionEnd events fire before then, the test still
+        completes without waiting for the timeout.
+
+        * animations/change-keyframes.html:
+        Increase the wiggle room. It's infrequently flaky now, but it is still
+        a tad bit flaky without this extra wiggle room.
+        * transitions/repeated-firing-background-color.html:
+        Remove a gratuitous setTimeout.
+        * transitions/transition-end-event-all-properties.html:
+        * transitions/transition-end-event-attributes.html:
+        * transitions/transition-end-event-container.html:
+        * transitions/transition-end-event-helpers.js:
+        (runTransitionTest.startTest):
+        (runTransitionTest):
+        * transitions/transition-end-event-left.html:
+        * transitions/transition-end-event-multiple-01.html:
+        * transitions/transition-end-event-multiple-02.html:
+        * transitions/transition-end-event-multiple-03.html:
+        * transitions/transition-end-event-multiple-04.html:
+        * transitions/transition-end-event-nested.html:
+        * transitions/transition-end-event-set-none.html:
+        * transitions/transition-end-event-transform.html:
+        * transitions/transition-end-event-window.html:
+        * transitions/zero-duration-with-non-zero-delay-end.html:
+
 2010-01-11  Darin Adler  <darin@apple.com>
 
         Try to get find-kana and find-russian tests passing on Qt.
index 9741320..b7016d2 100644 (file)
@@ -55,7 +55,7 @@
         keyframes.deleteRule("60%");
         keyframes.deleteRule("100%");
         keyframes.insertRule("0% { top: 50px; }");
-        keyframes.insertRule("30% { top: 100px; }");
+        keyframes.insertRule("10% { top: 100px; }");
         keyframes.insertRule("50% { top: 100px; }");
         keyframes.insertRule("100% { top: 150px; }");
         document.getElementById('box').style.webkitAnimationName = "anim";
index 7050626..0957570 100644 (file)
         document.getElementById('result').innerHTML = "Number of active transitions is (" + current + ") but was expecting (0)";
       layoutTestController.notifyDone();
     }
-    
+
     if (window.layoutTestController) {
         layoutTestController.dumpAsText();
         layoutTestController.waitUntilDone();
-        window.setTimeout(checkRunning, 300);            
     }
   </script>
 </head>
 <div id="foo">This should not be continually firing transitions</span>
 
 <script type="text/javascript" charset="utf-8">
+
+    document.getElementById('foo').addEventListener('webkitTransitionEnd', function() {
+        checkRunning()
+    });
+
     document.getElementById("foo").className="trans";
 </script>
 
index dbf4849..1412348 100644 (file)
@@ -52,7 +52,7 @@
       }
     }
     
-    runTransitionTest(expectedEndEvents, 1.0, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index b53a22f..37737a3 100644 (file)
@@ -27,7 +27,7 @@
       box.style.left = '200px';
     }
     
-    runTransitionTest(expectedEndEvents, 0.7, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index 0cdfbd4..8444989 100644 (file)
@@ -29,7 +29,7 @@
       box.style.left = '200px';
     }
     
-    runTransitionTest(expectedEndEvents, 0.7, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
   </script>
 </head>
 <body>
index e9d0854..5afee34 100644 (file)
@@ -36,7 +36,6 @@ Test page requirements:
 
 Function parameters:
     expected [required]: an array of arrays defining the expected parameter values for the recorded transition end events (see below)
-    timeout [required]: 
     callback [optional]: a function to be executed just before the test starts (none by default)
 
     Each sub-array must contain these items in this order:
@@ -46,7 +45,7 @@ Function parameters:
     - a boolean indicating if an event listener should be automatically added to the element to record the transition end event or if the script calls recordTransitionEndEvent() directly
 
 */
-function runTransitionTest(expected, timeout, callback)
+function runTransitionTest(expected, callback)
 {
   _expectedEventCount = expected.length;
 
@@ -135,21 +134,29 @@ function runTransitionTest(expected, timeout, callback)
         layoutTestController.notifyDone();
   }
 
-  function startTest(expected, timeout, callback)
+  function startTest(expected, callback)
   {
     if (callback)
       callback();
     
+    var maxTime = 0;
+
     for (var i=0; i < expected.length; ++i) {
       if (expected[i][3]) {
         var box = document.getElementById(expected[i][1]);
         box.addEventListener("webkitTransitionEnd", recordTransitionEndEvent, false);
       }
+
+      var time = expected[i][2];
+      if (time > maxTime)
+          maxTime = time;
     }
     
     _endFunction = function() { processEndEvents(expected); };
-    window.setTimeout(_endFunction, timeout * 1000);
+    // Add one second of fudge. We don't just use the run-webkit-tests timeout
+    // because processEndEvents gives more information on what failed.
+    window.setTimeout(_endFunction, maxTime * 1000 + 1000);
   }
   
-  window.addEventListener('load', function() { startTest(expected, timeout, callback) }, false);
+  window.addEventListener('load', function() { startTest(expected, callback) }, false);
 }
index 12347d3..5e4c6b8 100644 (file)
@@ -27,8 +27,7 @@
       box.style.left = '200px';
     }
     
-    runTransitionTest(expectedEndEvents, 0.7, setupTest);
-    
+    runTransitionTest(expectedEndEvents, setupTest);
   </script>
 </head>
 <body>
index 6b56c44..f582c8e 100644 (file)
@@ -34,7 +34,7 @@
       box.style.height = '80px';
     }
     
-    runTransitionTest(expectedEndEvents, 0.7, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index c802c33..934ac8c 100644 (file)
@@ -54,7 +54,7 @@
       }
     }
     
-    runTransitionTest(expectedEndEvents, 1.0, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index 328bbe8..f9e16fb 100644 (file)
@@ -77,7 +77,7 @@
       window.setTimeout(function() { transitionElement(5); }, 150);
     }
     
-    runTransitionTest(expectedEndEvents, 2.0, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index c021065..8ec1969 100644 (file)
@@ -68,7 +68,7 @@
       window.setTimeout(function() { transitionElement(5); }, 150);
     }
     
-    runTransitionTest(expectedEndEvents, 1.0, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index a49b571..87beacc 100644 (file)
@@ -77,7 +77,7 @@
       box.className = "box box1";
     }
     
-    runTransitionTest(expectedEndEvents, 2.0, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index 178bf1f..548c6f2 100644 (file)
@@ -51,7 +51,7 @@
       box.className = "box box1";
     }
     
-    runTransitionTest(expectedEndEvents, 0.5, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index 9324ce4..a5b92c5 100644 (file)
@@ -28,7 +28,7 @@
       box.style.webkitTransform = 'translate(200px)';
     }
     
-    runTransitionTest(expectedEndEvents, 0.7, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index 3efc05c..101c118 100644 (file)
@@ -29,7 +29,7 @@
       box.style.left = '200px';
     }
     
-    runTransitionTest(expectedEndEvents, 0.7, setupTest);
+    runTransitionTest(expectedEndEvents, setupTest);
     
   </script>
 </head>
index 0749839..4418418 100644 (file)
@@ -59,8 +59,7 @@
         
         var target = document.getElementById('target');
         target.style.left = '200px';
-        
-        window.setTimeout(runTest, 0);
+        runTest();
       }
     }