| <!DOCTYPE html> |
| |
| <html lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <style> |
| |
| body { |
| margin: 0; |
| } |
| |
| #target { |
| position: relative; |
| top: 100px; |
| left: 100px; |
| width: 200px; |
| height: 200px; |
| background-color: red; |
| -webkit-animation-name: anim1, anim2; |
| -webkit-animation-duration: 300ms, 300ms; |
| -webkit-animation-delay: 0s, 100ms; |
| -webkit-transition-property: top, width; |
| -webkit-transition-duration: 300ms, 300ms; |
| -webkit-transition-delay: 0s, 100ms; |
| } |
| |
| @-webkit-keyframes anim1 { |
| from { |
| left: 100px; |
| opacity: 1.0; |
| } |
| to { |
| left: 200px; |
| opacity: 0.0; |
| } |
| } |
| |
| @-webkit-keyframes anim2 { |
| from { |
| height: 200px; |
| } |
| to { |
| height: 50px; |
| } |
| } |
| |
| </style> |
| <script type="text/javascript" charset="utf-8"> |
| |
| function sample(time, expected, isLast) { |
| var current = internals.numberOfActiveAnimations(); |
| if (current == expected) |
| document.getElementById('result').innerHTML += "PASS: Number of active animations at " + time + "ms is (" + current + ") as expected<br>"; |
| else |
| document.getElementById('result').innerHTML += "FAIL: Number of active animations at " + time + "ms is (" + current + ") but was expecting (" + expected + ")<br>"; |
| if (isLast) |
| testRunner.notifyDone(); |
| } |
| |
| function startTest() { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| |
| var target = document.getElementById('target'); |
| target.style.top = '200px'; |
| target.style.width = '100px'; |
| |
| setTimeout(sample.bind(null, 0, 4, false), 0); |
| setTimeout(sample.bind(null, 200, 4, false), 200); |
| setTimeout(sample.bind(null, 500, 0, true), 500); |
| } |
| } |
| |
| </script> |
| </head> |
| <body onload="startTest()"> |
| <h1>Test for DRT numberOfActiveAnimations() API</h1> |
| |
| <div id="target"></div> |
| <div id="result"></div> |
| </body> |
| </html> |