Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="/w3c/resources/testharness.js"></script> | |
| 5 <script src="/w3c/resources/testharnessreport.js"></script> | |
| 6 <script src="mediasource-util.js"></script> | |
| 7 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | |
|
Srirama
2016/04/14 05:13:07
nit: may be use double quotes here to be consisten
wolenetz
2016/04/21 21:37:30
Copy-paste from another media-source layout test.
| |
| 8 </head> | |
| 9 <body> | |
| 10 <div id="log"></div> | |
|
Srirama
2016/04/14 05:13:07
do we need this div?
philipj_slow
2016/04/14 13:16:30
Nope :)
wolenetz
2016/04/21 21:37:30
Yet another copy-paste from another media-source l
| |
| 11 <script> | |
| 12 function attachWithPreloadTest(preload) | |
| 13 { | |
| 14 media_test(function(test) | |
| 15 { | |
| 16 var mediaTag = document.createElement('video'); | |
|
philipj_slow
2016/04/14 13:16:30
s/mediaTag/video/ since it's always a video
wolenetz
2016/04/21 21:37:30
Done.
| |
| 17 if (preload) | |
| 18 mediaTag.preload = preload; | |
| 19 document.body.appendChild(mediaTag); | |
| 20 | |
| 21 // Overload done() so that elements added to the document can be | |
| 22 // removed. | |
| 23 var removeMediaElement = true; | |
| 24 var oldTestDone = test.done.bind(test); | |
| 25 test.done = function() | |
| 26 { | |
| 27 if (removeMediaElement) { | |
|
philipj_slow
2016/04/14 13:16:30
It looks like what you want for this is test.add_c
wolenetz
2016/04/21 21:37:30
Yet another copy-paste from another media-source l
| |
| 28 document.body.removeChild(mediaTag); | |
| 29 removeMediaElements = false; | |
| 30 } | |
| 31 oldTestDone(); | |
| 32 }; | |
| 33 | |
| 34 var mediaSource = new MediaSource(); | |
| 35 var mediaSourceURL = URL.createObjectURL(mediaSource); | |
| 36 test.expectEvent(mediaSource, 'sourceopen'); | |
| 37 mediaTag.src = mediaSourceURL; | |
| 38 test.waitForExpectedEvents(function() | |
|
philipj_slow
2016/04/14 13:16:30
If this is the only reason you need yo use media_t
wolenetz
2016/04/21 21:37:30
Done, though "mediaSource.onsourceopen = ..." didn
philipj_slow
2016/04/22 09:22:15
Ah, I just assumed that the MediaSource interface
wolenetz
2016/04/25 19:43:21
Acknowledged.
| |
| 39 { | |
| 40 URL.revokeObjectURL(mediaSourceURL); | |
|
philipj_slow
2016/04/14 13:16:30
Maybe put this in the cleanup callback in case the
wolenetz
2016/04/21 21:37:30
Done.
| |
| 41 test.done(); | |
| 42 }); | |
| 43 }, 'sourceopen occurs with element preload="' + preload + '"'); | |
| 44 } | |
| 45 | |
| 46 attachWithPreloadTest(); | |
|
philipj_slow
2016/04/14 13:16:30
I don't think it's necessary to test the default b
wolenetz
2016/04/21 21:37:30
Done.
| |
| 47 attachWithPreloadTest('auto'); | |
| 48 attachWithPreloadTest('metadata'); | |
| 49 attachWithPreloadTest('none'); | |
| 50 </script> | |
| 51 </body> | |
| 52 </html> | |
| OLD | NEW |