Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src=media-file.js></script> | |
| 5 <script src=video-test.js></script> | |
| 6 <script> | |
| 7 var audio, sourceA, sourceB; | |
| 8 | |
| 9 function canplaythrough(e) | |
| 10 { | |
| 11 consoleWrite("EVENT(canplaythrough)"); | |
| 12 testExpected("audio.currentSrc", sourceA.src); | |
| 13 endTest(); | |
| 14 } | |
| 15 | |
| 16 function loadedMetadataA() | |
| 17 { | |
| 18 consoleWrite("loadedMetadataA"); | |
| 19 audio.removeChild(sourceA); | |
| 20 audio.appendChild(sourceB); | |
| 21 waitForEventAndFail("loadedmetadata", null); | |
|
acolwell GONE FROM CHROMIUM
2014/06/23 20:30:49
nit: You shouldn't need the null. waitForEventAndF
Srirama
2014/06/24 07:04:47
Done.
| |
| 22 } | |
| 23 | |
| 24 function onWindowLoad(e) | |
| 25 { | |
| 26 audio = document.getElementById('a'); | |
| 27 waitForEvent("loadstart"); | |
| 28 waitForEvent("progress"); | |
| 29 waitForEvent("emptied"); | |
| 30 waitForEvent("suspend"); | |
| 31 waitForEvent("loadedmetadata"); | |
| 32 waitForEvent("loadeddata"); | |
| 33 waitForEvent("canplay"); | |
| 34 audio.addEventListener('canplaythrough', canplaythrough); | |
|
acolwell GONE FROM CHROMIUM
2014/06/23 20:30:49
nit: Use waitForEventOnce() here as well and remov
Srirama
2014/06/24 07:04:47
Done.
| |
| 35 | |
| 36 sourceA = document.createElement("source"); | |
| 37 var audioFile = findMediaFile("audio", "content/test"); | |
| 38 sourceA.setAttribute("src", audioFile); | |
| 39 sourceB = document.createElement("source"); | |
| 40 audioFile = findMediaFile("audio", "content/silence"); | |
| 41 sourceB.setAttribute("src", audioFile); | |
| 42 | |
| 43 waitForEventOnce("loadedmetadata", loadedMetadataA); | |
| 44 audio.appendChild(sourceA); | |
| 45 } | |
| 46 | |
| 47 window.addEventListener('load', onWindowLoad, false); | |
| 48 </script> | |
| 49 </head> | |
| 50 <body> | |
| 51 <audio id="a"></audio> | |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |