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 |
| 8 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
| 9 </head> |
| 10 <body> |
| 11 <div id="log"></div> |
| 12 <script> |
| 13 mediasource_test(function(test, mediaElement, mediaSource) |
| 14 { |
| 15 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD
IO_VIDEO_TYPE); |
| 16 assert_true(sourceBuffer != null, "New SourceBuffer returned"); |
| 17 |
| 18 mediaSource.removeSourceBuffer(sourceBuffer); |
| 19 |
| 20 var sourceBuffer2 = mediaSource.addSourceBuffer(MediaSourceUtil.AU
DIO_VIDEO_TYPE); |
| 21 assert_true(sourceBuffer2 != null, "New SourceBuffer returned"); |
| 22 assert_true(sourceBuffer != sourceBuffer2, "SourceBuffers are diff
erent instances."); |
| 23 assert_equals(mediaSource.sourceBuffers.length, 1, "sourceBuffers.
length == 1"); |
| 24 |
| 25 test.done(); |
| 26 }, "Test addSourceBuffer(), removeSourceBuffer(), addSourceBuffer() se
quence."); |
| 27 |
| 28 mediasource_test(function(test, mediaElement, mediaSource) |
| 29 { |
| 30 assert_throws("InvalidAccessError", |
| 31 function() { mediaSource.removeSourceBuffer(null); }, |
| 32 "removeSourceBuffer() threw an exception when passed n
ull."); |
| 33 test.done(); |
| 34 }, "Test removeSourceBuffer() with null"); |
| 35 |
| 36 mediasource_test(function(test, mediaElement, mediaSource) |
| 37 { |
| 38 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD
IO_VIDEO_TYPE); |
| 39 assert_true(sourceBuffer != null, "New SourceBuffer returned"); |
| 40 |
| 41 mediaSource.removeSourceBuffer(sourceBuffer); |
| 42 |
| 43 assert_throws("NotFoundError", |
| 44 function() { mediaSource.removeSourceBuffer(sourceBuffer); }, |
| 45 "removeSourceBuffer() threw an exception when a SourceBuffer t
hat was already removed."); |
| 46 |
| 47 test.done(); |
| 48 }, "Test calling removeSourceBuffer() twice with the same object."); |
| 49 |
| 50 </script> |
| 51 </body> |
| 52 </html> |
OLD | NEW |