Use testRunner instead of layoutTestController in animations tests
[WebKit-https.git] / LayoutTests / animations / combo-transform-translate+scale.html
index db311f2..fbd5073 100644 (file)
@@ -10,7 +10,7 @@
       height: 100px;
       width: 100px;
       background-color: blue;
-      -webkit-animation-duration: 2s;
+      -webkit-animation-duration: 1s;
       -webkit-animation-timing-function: linear;
       -webkit-animation-name: "anim";
     }
     }
   </style>
   <script type="text/javascript" charset="utf-8">
-    if (window.layoutTestController) {
-      layoutTestController.dumpAsText();
-      layoutTestController.waitUntilDone();
+    if (window.testRunner) {
+      testRunner.dumpAsText();
+      testRunner.waitUntilDone();
     }
     
-    result = "PASS";
-    const defaultTolerance = 0.2;
-    
+    result = "";
+
     const expected =  [ [ 1.25,0,0,1.75,25,50 ],
                         [ 1.5,0,0,2.5,50,100 ] ];
-    const tolerance = [ 0.2,0.2,0.2,0.2,5,5 ];
+    const tolerance = [ 0.2,0.2,0.2,0.3,8,15 ];
     const prop = [ "a", "b", "c", "d", "e", "f" ];
     
     function isEqual(actual, desired, tolerance)
     {
-        if (tolerance == undefined || tolerance == 0)
-            tolerance = defaultTolerance;
         var diff = Math.abs(actual - desired);
         return diff <= tolerance;
     }
     
+    var numSnapshots = 0;
+    
     function snapshot(which)
     {
-        if (result != "PASS")
-            return;
-        
         var t = new WebKitCSSMatrix(window.getComputedStyle(document.getElementById('box')).webkitTransform);
-        for (i = 0; i < 6; ++i)
-            if (!isEqual(t[prop[i]], expected[which][i], tolerance[i])) {
-                result = "FAIL('"+prop[i]+"' was:"+t[prop[i]]+", expected:"+expected[which][i]+")";
-                return;
-            }
+        for (i = 0; i < 6; ++i) {
+            if (!isEqual(t[prop[i]], expected[which][i], tolerance[i]))
+                result += "FAIL('"+prop[i]+"' was:"+t[prop[i]]+", expected:"+expected[which][i]+")";
+        }
+        
+        numSnapshots++;
+        if (numSnapshots == 2) {
+            document.getElementById('result').innerHTML = result || "PASS";
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
     }
 
     function start()
     {
-        setTimeout("snapshot(0)", 500);
-        setTimeout("snapshot(1)", 1000);
-        
-        window.setTimeout(function() {
-            document.getElementById('result').innerHTML = result;
-            if (window.layoutTestController)
-                layoutTestController.notifyDone();
-        }, 1100);
+        setTimeout("snapshot(0)", 250);
+        setTimeout("snapshot(1)", 500);
     }
     
     document.addEventListener('webkitAnimationStart', start, false);
@@ -71,8 +67,8 @@
   </script>
 </head>
 <body>
-This test performs an animation of the translate() and scale() operators. It animates over 2 seconds. 
-At 0.5 and 1 second it takes a snapshot and expects the result to be within range.
+This test performs an animation of the translate() and scale() operators. It animates over 1 seconds. 
+At 0.25 and 0.5 seconds it takes a snapshot and expects the result to be within range.
 <div id="box">
 </div>
 <div id="result">