| 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 | 7 |
| 8 <link rel='stylesheet' href='/w3c/resources/testharness.css'> | 8 <link rel='stylesheet' href='/w3c/resources/testharness.css'> |
| 9 </head> | 9 </head> |
| 10 <body> | 10 <body> |
| 11 <div id="log"></div> | 11 <div id="log"></div> |
| 12 <script> | 12 <script> |
| 13 // TODO(wolenetz): Remove this hacky console warning once desktop and | 13 // TODO(wolenetz): Remove this hacky console warning once desktop and |
| 14 // android expectations match. It allows a passing platform-specific | 14 // android expectations match. It allows a passing platform-specific |
| 15 // expectation to override a failing non-platform-specific expectation
. | 15 // expectation to override a failing non-platform-specific expectation
. |
| 16 console.warn('Ignore this warning. See https://crbug.com/568704#c2'); | 16 console.warn('Ignore this warning. See https://crbug.com/568704#c2'); |
| 17 | 17 |
| 18 mediasource_test(function(test, mediaElement, mediaSource) | 18 mediasource_test(function(test, mediaElement, mediaSource) |
| 19 { | 19 { |
| 20 // TODO(wolenetz): This endOfStream() shouldn't trigger a MediaErr
or. See https://crbug.com/600810. |
| 20 mediaSource.endOfStream(); | 21 mediaSource.endOfStream(); |
| 21 assert_throws("InvalidStateError", | 22 assert_throws("InvalidStateError", |
| 22 function() { mediaSource.addSourceBuffer(MediaSourceUt
il.AUDIO_VIDEO_TYPE); }, | 23 function() { mediaSource.addSourceBuffer(MediaSourceUt
il.AUDIO_VIDEO_TYPE); }, |
| 23 "addSourceBuffer() threw an exception when in 'ended'
state."); | 24 "addSourceBuffer() threw an exception when in 'ended'
state."); |
| 24 test.done(); | 25 test.done(); |
| 25 }, "Test addSourceBuffer() in 'ended' state."); | 26 }, "Test addSourceBuffer() in 'ended' state."); |
| 26 | 27 |
| 27 mediasource_test(function(test, mediaElement, mediaSource) | 28 mediasource_test(function(test, mediaElement, mediaSource) |
| 28 { | 29 { |
| 29 assert_throws("InvalidAccessError", | 30 assert_throws("InvalidAccessError", |
| 30 function() { mediaSource.addSourceBuffer(""); }, | 31 function() { mediaSource.addSourceBuffer(""); }, |
| 31 "addSourceBuffer() threw an exception when passed an e
mpty string."); | 32 "addSourceBuffer() threw an exception when passed an e
mpty string."); |
| 32 test.done(); | 33 test.done(); |
| 33 }, "Test addSourceBuffer() with empty type"); | 34 }, "Test addSourceBuffer() with empty type"); |
| 34 | 35 |
| 35 mediasource_test(function(test, mediaElement, mediaSource) | 36 mediasource_test(function(test, mediaElement, mediaSource) |
| 36 { | 37 { |
| 37 assert_throws("NotSupportedError", | 38 assert_throws("NotSupportedError", |
| 38 function() { mediaSource.addSourceBuffer(null); }, | 39 function() { mediaSource.addSourceBuffer(null); }, |
| 39 "addSourceBuffer() threw an exception when passed null
."); | 40 "addSourceBuffer() threw an exception when passed null
."); |
| 40 test.done(); | 41 test.done(); |
| 41 }, "Test addSourceBuffer() with null"); | 42 }, "Test addSourceBuffer() with null"); |
| 42 | 43 |
| 43 mediasource_test(function(test, mediaElement, mediaSource) | 44 mediasource_test(function(test, mediaElement, mediaSource) |
| 44 { | 45 { |
| 45 assert_throws("NotSupportedError", | 46 assert_throws("NotSupportedError", |
| 46 function() { mediaSource.addSourceBuffer("invalidType"
); }, | 47 function() { mediaSource.addSourceBuffer("invalidType"
); }, |
| 47 "addSourceBuffer() threw an exception for an unsupport
ed type."); | 48 "addSourceBuffer() threw an exception for an unsupport
ed type."); |
| 48 test.done(); | 49 test.done(); |
| 49 }, "Test addSourceBuffer() with unsupported type"); | 50 }, "Test addSourceBuffer() with unsupported type"); |
| 50 | 51 |
| 51 mediasource_test(function(test, mediaElement, mediaSource) | 52 mediasource_test(function(test, mediaElement, mediaSource) |
| 52 { | 53 { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 83 var mimetype = MediaSourceUtil.VIDEO_ONLY_TYPE; | 84 var mimetype = MediaSourceUtil.VIDEO_ONLY_TYPE; |
| 84 | 85 |
| 85 assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is
supported"); | 86 assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is
supported"); |
| 86 | 87 |
| 87 var sourceBuffer = mediaSource.addSourceBuffer(mimetype); | 88 var sourceBuffer = mediaSource.addSourceBuffer(mimetype); |
| 88 assert_true(sourceBuffer != null, "New SourceBuffer returned"); | 89 assert_true(sourceBuffer != null, "New SourceBuffer returned"); |
| 89 assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceB
uffer is in mediaSource.sourceBuffers"); | 90 assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceB
uffer is in mediaSource.sourceBuffers"); |
| 90 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu
ffer is not in mediaSource.activeSourceBuffers"); | 91 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu
ffer is not in mediaSource.activeSourceBuffers"); |
| 91 test.done(); | 92 test.done(); |
| 92 }, "Test addSourceBuffer() video only"); | 93 }, "Test addSourceBuffer() video only"); |
| 93 | 94 |
| 94 mediasource_test(function(test, mediaElement, mediaSource) | 95 mediasource_test(function(test, mediaElement, mediaSource) |
| 95 { | 96 { |
| 96 var mimetype = MediaSourceUtil.AUDIO_ONLY_TYPE; | 97 var mimetype = MediaSourceUtil.AUDIO_ONLY_TYPE; |
| 97 | 98 |
| 98 assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is
supported"); | 99 assert_true(MediaSource.isTypeSupported(mimetype), mimetype + " is
supported"); |
| 99 | 100 |
| 100 var sourceBuffer = mediaSource.addSourceBuffer(mimetype); | 101 var sourceBuffer = mediaSource.addSourceBuffer(mimetype); |
| 101 assert_true(sourceBuffer != null, "New SourceBuffer returned"); | 102 assert_true(sourceBuffer != null, "New SourceBuffer returned"); |
| 102 assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceB
uffer is in mediaSource.sourceBuffers"); | 103 assert_equals(mediaSource.sourceBuffers[0], sourceBuffer, "SourceB
uffer is in mediaSource.sourceBuffers"); |
| 103 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu
ffer is not in mediaSource.activeSourceBuffers"); | 104 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu
ffer is not in mediaSource.activeSourceBuffers"); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 reachedLimit = true; | 149 reachedLimit = true; |
| 149 break; | 150 break; |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 assert_true(reachedLimit, "Reached SourceBuffer limit."); | 153 assert_true(reachedLimit, "Reached SourceBuffer limit."); |
| 153 test.done(); | 154 test.done(); |
| 154 }, "Test addSourceBuffer() QuotaExceededError."); | 155 }, "Test addSourceBuffer() QuotaExceededError."); |
| 155 </script> | 156 </script> |
| 156 </body> | 157 </body> |
| 157 </html> | 158 </html> |
| OLD | NEW |