| OLD | NEW |
| 1 function waitForMultipleEvents(name, times, func) { | 1 function waitForMultipleEvents(name, times, func) { |
| 2 var count = 0; | 2 var count = 0; |
| 3 document.addEventListener(name, function() { | 3 document.addEventListener(name, function() { |
| 4 if (++count == times) { | 4 if (++count == times) { |
| 5 func(); | 5 func(); |
| 6 } | 6 } |
| 7 }, true); | 7 }, true); |
| 8 } | 8 } |
| 9 | 9 |
| 10 function init() | 10 function init() |
| 11 { | 11 { |
| 12 var videos = document.getElementsByTagName('video'); | 12 var videos = document.getElementsByTagName('video'); |
| 13 | 13 |
| 14 waitForMultipleEvents("canplaythrough", videos.length, function() { | 14 waitForMultipleEvents("canplaythrough", videos.length, function() { |
| 15 for (var i = 0; i < videos.length; ++i) { | 15 for (var i = 0; i < videos.length; ++i) { |
| 16 videos[i].play(); | 16 videos[i].play(); |
| 17 videos[i].addEventListener("playing", function(event) { | 17 videos[i].addEventListener("playing", function(event) { |
| 18 event.target.pause(); | 18 event.target.pause(); |
| 19 event.target.currentTime = 0; | 19 event.target.currentTime = 0; |
| 20 }); | 20 }); |
| 21 } | 21 } |
| 22 | 22 |
| 23 waitForMultipleEvents("seeked", videos.length, function() { | 23 waitForMultipleEvents("seeked", videos.length, function() { |
| 24 if (window.testRunner) | 24 if (window.testRunner) { |
| 25 testRunner.notifyDone(); | 25 testRunner.layoutAndPaintAsyncThen(function() { |
| 26 testRunner.notifyDone(); |
| 27 }); |
| 28 } |
| 26 }); | 29 }); |
| 27 }); | 30 }); |
| 28 } | 31 } |
| 29 | 32 |
| 30 if (window.testRunner) { | 33 if (window.testRunner) { |
| 31 testRunner.waitUntilDone(); | 34 testRunner.waitUntilDone(); |
| 32 setTimeout(function() { | 35 setTimeout(function() { |
| 33 document.body.appendChild(document.createTextNode('FAIL')); | 36 document.body.appendChild(document.createTextNode('FAIL')); |
| 34 if (window.testRunner) | 37 if (window.testRunner) |
| 35 testRunner.notifyDone(); | 38 testRunner.notifyDone(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 | 61 |
| 59 function initAndSeeked() | 62 function initAndSeeked() |
| 60 { | 63 { |
| 61 var videos = document.getElementsByTagName('video'); | 64 var videos = document.getElementsByTagName('video'); |
| 62 | 65 |
| 63 waitForMultipleEvents("seeked", videos.length, function() { | 66 waitForMultipleEvents("seeked", videos.length, function() { |
| 64 if (window.testRunner) | 67 if (window.testRunner) |
| 65 testRunner.notifyDone(); | 68 testRunner.notifyDone(); |
| 66 }); | 69 }); |
| 67 } | 70 } |
| OLD | NEW |