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"> | |
8 </head> | |
9 <body> | |
10 <script> | |
11 function attachWithPreloadTest(preload) | |
12 { | |
13 async_test(function(test) | |
14 { | |
15 var videoTag = document.createElement('video'); | |
philipj_slow
2016/04/22 09:22:15
I was thinking just "video", I take "tag" to mean
wolenetz
2016/04/25 19:43:21
Done.
| |
16 var mediaSource = new MediaSource(); | |
17 var mediaSourceURL = URL.createObjectURL(mediaSource); | |
18 | |
19 videoTag.preload = preload; | |
20 document.body.appendChild(videoTag); | |
21 test.add_cleanup(function() { | |
22 document.body.removeChild(videoTag); | |
23 URL.revokeObjectURL(mediaSourceURL); | |
24 }); | |
25 | |
26 var listener = test.step_func(function(event) | |
27 { | |
28 mediaSource.removeEventListener("sourceopen", listener); | |
philipj_slow
2016/04/22 09:22:15
Do you need to remove the event listener, can the
wolenetz
2016/04/25 19:43:21
Done.
| |
29 test.done(); | |
30 }); | |
31 | |
32 mediaSource.addEventListener("sourceopen", listener); | |
33 videoTag.src = mediaSourceURL; | |
34 }, "sourceopen occurs with element preload=" + preload); | |
35 } | |
36 | |
37 attachWithPreloadTest('auto'); | |
38 attachWithPreloadTest('metadata'); | |
39 attachWithPreloadTest('none'); | |
40 | |
41 function errorWithPreloadTest(preload) | |
42 { | |
43 async_test(function(test) | |
44 { | |
45 var videoTag = document.createElement('video'); | |
46 var mediaSource = new MediaSource(); | |
47 var mediaSourceURL = URL.createObjectURL(mediaSource); | |
48 URL.revokeObjectURL(mediaSourceURL); | |
49 | |
50 videoTag.preload = preload; | |
51 document.body.appendChild(videoTag); | |
52 test.add_cleanup(function() { document.body.removeChild(vide oTag); }); | |
53 | |
54 var listener = test.step_func(function(event) | |
55 { | |
56 mediaSource.removeEventListener("sourceopen", listener); | |
57 test.fail(); | |
58 }); | |
59 | |
60 mediaSource.addEventListener("sourceopen", listener); | |
61 | |
62 videoTag.onerror = test.step_func(function(event) { test.don e(); }); | |
63 videoTag.src = mediaSourceURL; | |
64 }, "error occurs with bogus (revoked) object URL and element pre load=" + preload); | |
philipj_slow
2016/04/22 09:22:15
This is good, I didn't think to test revoked URLs.
wolenetz
2016/04/25 19:43:21
Done. (blob:a and real unrevoked MediaSource objec
| |
65 } | |
66 | |
67 errorWithPreloadTest('auto'); | |
68 errorWithPreloadTest('metadata'); | |
69 errorWithPreloadTest('none'); | |
70 </script> | |
71 </body> | |
72 </html> | |
OLD | NEW |