OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="/w3c/resources/testharness.js"></script> | 4 <script src="/w3c/resources/testharness.js"></script> |
5 <script src="/w3c/resources/testharnessreport.js"></script> | 5 <script src="/w3c/resources/testharnessreport.js"></script> |
6 <script src="mediasource-util.js"></script> | 6 <script src="mediasource-util.js"></script> |
7 <link rel="stylesheet" href="/w3c/resources/testharness.css"> | 7 <link rel="stylesheet" href="/w3c/resources/testharness.css"> |
Srirama
2016/04/27 04:56:04
I think we can remove this css file. I ran it loca
philipj_slow
2016/04/27 12:36:27
Yep, Output.prototype.show_results in testharness.
wolenetz
2016/04/27 18:54:53
Done. I also removed the inclusion of mediasource-
| |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
11 function attachWithPreloadTest(preload) | 11 function attachWithPreloadTest(preload) |
12 { | 12 { |
13 async_test(function(test) | 13 async_test(function(test) |
14 { | 14 { |
15 var video = document.createElement("video"); | 15 var video = document.createElement("video"); |
16 var mediaSource = new MediaSource(); | 16 var mediaSource = new MediaSource(); |
17 var mediaSourceURL = URL.createObjectURL(mediaSource); | 17 var mediaSourceURL = URL.createObjectURL(mediaSource); |
18 | 18 |
19 video.preload = preload; | 19 video.preload = preload; |
20 document.body.appendChild(video); | 20 document.body.appendChild(video); |
21 test.add_cleanup(function() { | 21 test.add_cleanup(function() { |
22 document.body.removeChild(video); | 22 document.body.removeChild(video); |
23 URL.revokeObjectURL(mediaSourceURL); | 23 URL.revokeObjectURL(mediaSourceURL); |
24 }); | 24 }); |
25 | 25 |
26 var listener = test.step_func(function(event) { test.done(); }); | 26 mediaSource.addEventListener("sourceopen", test.step_func_do ne()); |
27 mediaSource.addEventListener("sourceopen", listener); | |
28 video.src = mediaSourceURL; | 27 video.src = mediaSourceURL; |
29 }, "sourceopen occurs with element preload=" + preload); | 28 }, "sourceopen occurs with element preload=" + preload); |
30 } | 29 } |
31 | 30 |
32 attachWithPreloadTest("auto"); | 31 attachWithPreloadTest("auto"); |
33 attachWithPreloadTest("metadata"); | 32 attachWithPreloadTest("metadata"); |
34 attachWithPreloadTest("none"); | 33 attachWithPreloadTest("none"); |
35 | 34 |
36 function errorWithPreloadTest(preload, bogusURLStyle) | 35 function errorWithPreloadTest(preload, bogusURLStyle) |
37 { | 36 { |
38 var testURLdescription; | |
39 var mediaSource = new MediaSource(); | |
40 var bogusURL; | |
41 | |
42 if (bogusURLStyle == "revoked") { | |
43 testURLdescription = "revoked MediaSource object URL"; | |
44 bogusURL = URL.createObjectURL(mediaSource); | |
45 URL.revokeObjectURL(bogusURL); | |
46 } else if (bogusURLStyle == "corrupted") { | |
47 testURLdescription = "corrupted MediaSource object URL"; | |
48 bogusURL = URL.createObjectURL(mediaSource); | |
49 bogusURL += "0"; | |
50 } else { | |
51 testURLdescription = bogusURL = bogusURLStyle; | |
52 } | |
53 | |
54 async_test(function(test) | 37 async_test(function(test) |
55 { | 38 { |
39 var mediaSource = new MediaSource(); | |
40 var bogusURL = URL.createObjectURL(mediaSource); | |
41 | |
42 if (bogusURLStyle == "corrupted") { | |
43 var goodURL = bogusURL; | |
44 test.add_cleanup(function() { URL.revokeObjectURL(goodUR L); }); | |
45 bogusURL += "0"; | |
46 } else if (bogusURLStyle == "revoked") { | |
47 URL.revokeObjectURL(bogusURL); | |
48 } else { | |
49 assert_unreached("invalid case"); | |
50 } | |
51 | |
56 var video = document.createElement("video"); | 52 var video = document.createElement("video"); |
57 | |
58 video.preload = preload; | 53 video.preload = preload; |
59 document.body.appendChild(video); | 54 document.body.appendChild(video); |
60 test.add_cleanup(function() { document.body.removeChild(vide o); }); | 55 test.add_cleanup(function() { document.body.removeChild(vide o); }); |
61 | 56 |
62 var listener = test.step_func(function(event) { test.fail(); }); | 57 mediaSource.addEventListener("sourceopen", test.unreached_fu nc("'sourceopen' should not occur")); |
philipj_slow
2016/04/27 12:36:27
I guess I would say "should not be fired" to make
wolenetz
2016/04/27 18:54:53
Done.
| |
63 mediaSource.addEventListener("sourceopen", listener); | |
64 | 58 |
65 video.onerror = test.step_func(function(event) { test.done() ; }); | 59 video.onerror = test.step_func_done(); |
66 video.src = bogusURL; | 60 video.src = bogusURL; |
67 }, "error occurs with bogus blob URL (" + testURLdescription + " ) and element preload=" + preload); | 61 }, "error occurs with bogus blob URL (" + bogusURLStyle + " Medi aSource object URL) and element preload=" + preload); |
68 } | 62 } |
69 | 63 |
70 errorWithPreloadTest("auto", "revoked"); | 64 errorWithPreloadTest("auto", "revoked"); |
71 errorWithPreloadTest("metadata", "revoked"); | 65 errorWithPreloadTest("metadata", "revoked"); |
72 errorWithPreloadTest("none", "revoked"); | 66 errorWithPreloadTest("none", "revoked"); |
73 | 67 |
74 errorWithPreloadTest("auto", "blob:a"); | |
75 errorWithPreloadTest("metadata", "blob:a"); | |
76 errorWithPreloadTest("none", "blob:a"); | |
77 | |
78 errorWithPreloadTest("auto", "corrupted"); | 68 errorWithPreloadTest("auto", "corrupted"); |
79 errorWithPreloadTest("metadata", "corrupted"); | 69 errorWithPreloadTest("metadata", "corrupted"); |
80 errorWithPreloadTest("none", "corrupted"); | 70 errorWithPreloadTest("none", "corrupted"); |
81 </script> | 71 </script> |
82 </body> | 72 </body> |
83 </html> | 73 </html> |
OLD | NEW |