<!DOCTYPE html>
<html>
<head>
  <title>Tests that custom events with prefixed animations names are correctly dispatched.</title>
  <script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    document.addEventListener('animationstart', function(e) {
      document.getElementById('result').innerHTML += 'FAIL: animationstart event listener should not have been called.<br>';
    }, false);

    document.addEventListener('webkitAnimationStart', function(e) {
      document.getElementById('result').innerHTML += 'PASS: webkitAnimationStart event listener has been called.<br>';
    }, false);

    document.addEventListener('animationiteration', function(e) {
      document.getElementById('result').innerHTML += 'FAIL: animationiteration event listener should not have been called.<br>';
    }, false);

    document.addEventListener('webkitAnimationIteration', function(e) {
      document.getElementById('result').innerHTML += 'PASS: webkitAnimationIteration event listener has been called.<br>';
    }, false);

    document.addEventListener('animationend', function(e) {
      document.getElementById('result').innerHTML += 'FAIL: animationend event listener should not have been called.';
      if (window.testRunner)
        testRunner.notifyDone();
    }, false);

    document.addEventListener('webkitAnimationEnd', function(e) {
      document.getElementById('result').innerHTML += 'PASS: webkitAnimationEnd event has been called.';
      if (window.testRunner)
        testRunner.notifyDone();
    }, false);

  </script>
</head>
<body>
Tests that custom events with prefixed animations names are correctly dispatched.
<pre id="result"></pre>
</body>
<script>
  var custom = document.createEvent('CustomEvent');
  custom.initCustomEvent('webkitAnimationStart', true, true, null);
  document.dispatchEvent(custom);
  custom = document.createEvent('CustomEvent');
  custom.initCustomEvent('webkitAnimationIteration', true, true, null);
  document.dispatchEvent(custom);
  custom = document.createEvent('CustomEvent');
  custom.initCustomEvent('webkitAnimationEnd', true, true, null);
  document.dispatchEvent(custom);
</script>
</html>
