| 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.layoutAndPaintAsyncThen(function() { | 25 testRunner.notifyDone(); |
| 26 testRunner.notifyDone(); | |
| 27 }); | |
| 28 } | |
| 29 }); | 26 }); |
| 30 }); | 27 }); |
| 31 } | 28 } |
| 32 | 29 |
| 33 if (window.testRunner) { | 30 if (window.testRunner) { |
| 34 testRunner.waitUntilDone(); | 31 testRunner.waitUntilDone(); |
| 35 setTimeout(function() { | 32 setTimeout(function() { |
| 36 document.body.appendChild(document.createTextNode('FAIL')); | 33 document.body.appendChild(document.createTextNode('FAIL')); |
| 37 if (window.testRunner) | 34 if (window.testRunner) |
| 38 testRunner.notifyDone(); | 35 testRunner.notifyDone(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 61 | 58 |
| 62 function initAndSeeked() | 59 function initAndSeeked() |
| 63 { | 60 { |
| 64 var videos = document.getElementsByTagName('video'); | 61 var videos = document.getElementsByTagName('video'); |
| 65 | 62 |
| 66 waitForMultipleEvents("seeked", videos.length, function() { | 63 waitForMultipleEvents("seeked", videos.length, function() { |
| 67 if (window.testRunner) | 64 if (window.testRunner) |
| 68 testRunner.notifyDone(); | 65 testRunner.notifyDone(); |
| 69 }); | 66 }); |
| 70 } | 67 } |
| OLD | NEW |