Chromium Code Reviews| 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'> |
| 8 </head> | 8 </head> |
| 9 <body> | 9 <body> |
| 10 <div id="log"></div> | 10 <div id="log"></div> |
| 11 <script> | 11 <script> |
| 12 mediasource_test(function(test, mediaElement, mediaSource) | 12 mediasource_test(function(test, mediaElement, mediaSource) |
| 13 { | 13 { |
| 14 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 14 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| 15 | 15 |
| 16 assert_throws("InvalidAccessError", function() | 16 mediaSource.duration = 10; |
|
chcunningham
2016/09/07 18:36:05
Remind me again, why were these added?
Edit: answ
wolenetz
2016/09/07 21:09:26
Acknowledged.
| |
| 17 | |
| 18 assert_throws(new TypeError(), function() | |
| 17 { | 19 { |
| 18 sourceBuffer.remove(-1, 2); | 20 sourceBuffer.remove(-1, 2); |
| 19 }, "remove"); | 21 }, "remove"); |
| 20 | 22 |
| 21 test.done(); | 23 test.done(); |
| 22 }, "Test remove with a negative start."); | 24 }, "Test remove with a negative start."); |
| 23 | 25 |
| 24 mediasource_test(function(test, mediaElement, mediaSource) | 26 mediasource_test(function(test, mediaElement, mediaSource) |
| 25 { | 27 { |
| 26 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 28 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| 27 | 29 |
| 30 mediaSource.duration = 10; | |
| 31 | |
| 28 [ undefined, NaN, Infinity, -Infinity ].forEach(function(item) | 32 [ undefined, NaN, Infinity, -Infinity ].forEach(function(item) |
| 29 { | 33 { |
| 30 assert_throws(new TypeError(), function() | 34 assert_throws(new TypeError(), function() |
| 31 { | 35 { |
| 32 sourceBuffer.remove(item, 2); | 36 sourceBuffer.remove(item, 2); |
| 33 }, "remove"); | 37 }, "remove"); |
| 34 }); | 38 }); |
| 35 | 39 |
| 36 test.done(); | 40 test.done(); |
| 37 }, "Test remove with non-finite start."); | 41 }, "Test remove with non-finite start."); |
| 38 | 42 |
| 39 mediasource_test(function(test, mediaElement, mediaSource) | 43 mediasource_test(function(test, mediaElement, mediaSource) |
| 40 { | 44 { |
| 41 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 45 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| 42 | 46 |
| 43 mediaSource.duration = 10; | 47 mediaSource.duration = 10; |
| 44 | 48 |
| 45 assert_throws("InvalidAccessError", function() | 49 assert_throws(new TypeError(), function() |
| 46 { | 50 { |
| 47 sourceBuffer.remove(11, 12); | 51 sourceBuffer.remove(11, 12); |
| 48 }, "remove"); | 52 }, "remove"); |
| 49 | 53 |
| 50 test.done(); | 54 test.done(); |
| 51 }, "Test remove with a start beyond the duration."); | 55 }, "Test remove with a start beyond the duration."); |
| 52 | 56 |
| 53 mediasource_test(function(test, mediaElement, mediaSource) | 57 mediasource_test(function(test, mediaElement, mediaSource) |
| 54 { | 58 { |
| 55 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 59 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| 56 | 60 |
| 57 mediaSource.duration = 10; | 61 mediaSource.duration = 10; |
| 58 | 62 |
| 59 assert_throws("InvalidAccessError", function() | 63 assert_throws(new TypeError(), function() |
| 60 { | 64 { |
| 61 sourceBuffer.remove(2, 1); | 65 sourceBuffer.remove(2, 1); |
| 62 }, "remove"); | 66 }, "remove"); |
| 63 | 67 |
| 64 test.done(); | 68 test.done(); |
| 65 }, "Test remove with a start larger than the end."); | 69 }, "Test remove with a start larger than the end."); |
| 66 | 70 |
| 67 | 71 |
| 68 mediasource_test(function(test, mediaElement, mediaSource) | 72 mediasource_test(function(test, mediaElement, mediaSource) |
| 69 { | 73 { |
| 70 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 74 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| 71 | 75 |
| 72 assert_throws("InvalidAccessError", function() | 76 mediaSource.duration = 10; |
| 77 | |
| 78 assert_throws(new TypeError(), function() | |
| 73 { | 79 { |
| 74 sourceBuffer.remove(0, Number.NEGATIVE_INFINITY); | 80 sourceBuffer.remove(0, Number.NEGATIVE_INFINITY); |
| 75 }, "remove"); | 81 }, "remove"); |
| 76 | 82 |
| 77 test.done(); | 83 test.done(); |
| 78 }, "Test remove with a NEGATIVE_INFINITY end."); | 84 }, "Test remove with a NEGATIVE_INFINITY end."); |
| 79 | 85 |
| 80 mediasource_test(function(test, mediaElement, mediaSource) | 86 mediasource_test(function(test, mediaElement, mediaSource) |
| 81 { | 87 { |
| 82 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 88 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| 83 | 89 |
| 84 assert_throws("InvalidAccessError", function() | 90 mediaSource.duration = 10; |
| 91 | |
| 92 assert_throws(new TypeError(), function() | |
| 85 { | 93 { |
| 86 sourceBuffer.remove(0, Number.NaN); | 94 sourceBuffer.remove(0, Number.NaN); |
| 87 }, "remove"); | 95 }, "remove"); |
| 88 | 96 |
| 89 test.done(); | 97 test.done(); |
| 90 }, "Test remove with a NaN end."); | 98 }, "Test remove with a NaN end."); |
| 91 | 99 |
| 92 mediasource_test(function(test, mediaElement, mediaSource) | 100 mediasource_test(function(test, mediaElement, mediaSource) |
| 93 { | 101 { |
| 94 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); | 102 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 mp4: "{ [0.000, 1.022) }", | 291 mp4: "{ [0.000, 1.022) }", |
| 284 }; | 292 }; |
| 285 | 293 |
| 286 // Using MAX_VALUE rather than POSITIVE_INFINITY here due to lack | 294 // Using MAX_VALUE rather than POSITIVE_INFINITY here due to lack |
| 287 // of 'unrestricted' on end parameter. (See comment in SourceBuffe r.idl) | 295 // of 'unrestricted' on end parameter. (See comment in SourceBuffe r.idl) |
| 288 removeAndCheckBufferedRanges(test, sourceBuffer, 1, Number.MAX_VAL UE, expectations[subType]); | 296 removeAndCheckBufferedRanges(test, sourceBuffer, 1, Number.MAX_VAL UE, expectations[subType]); |
| 289 }, "Test removing the end of appended data."); | 297 }, "Test removing the end of appended data."); |
| 290 </script> | 298 </script> |
| 291 </body> | 299 </body> |
| 292 </html> | 300 </html> |
| OLD | NEW |