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> |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 127 |
128 var sourceBufferA = mediaSource.addSourceBuffer(videoMimetype); | 128 var sourceBufferA = mediaSource.addSourceBuffer(videoMimetype); |
129 var sourceBufferB = mediaSource.addSourceBuffer(audioMimetype); | 129 var sourceBufferB = mediaSource.addSourceBuffer(audioMimetype); |
130 assert_equals(mediaSource.sourceBuffers[0], sourceBufferA, "source BufferA is in mediaSource.sourceBuffers"); | 130 assert_equals(mediaSource.sourceBuffers[0], sourceBufferA, "source BufferA is in mediaSource.sourceBuffers"); |
131 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu fferA is not in mediaSource.activeSourceBuffers"); | 131 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu fferA is not in mediaSource.activeSourceBuffers"); |
132 assert_equals(mediaSource.sourceBuffers[1], sourceBufferB, "source BufferB is in mediaSource.sourceBuffers"); | 132 assert_equals(mediaSource.sourceBuffers[1], sourceBufferB, "source BufferB is in mediaSource.sourceBuffers"); |
133 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu fferB is not in mediaSource.activeSourceBuffers"); | 133 assert_equals(mediaSource.activeSourceBuffers.length, 0, "SourceBu fferB is not in mediaSource.activeSourceBuffers"); |
134 test.done(); | 134 test.done(); |
135 }, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffer s"); | 135 }, "Test addSourceBuffer() with AAC and H.264 in separate SourceBuffer s"); |
136 | 136 |
137 mediasource_test(function(test, mediaElement, mediaSource) | 137 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) |
138 { | 138 { |
139 var reachedLimit = false; | 139 sourceBuffer.appendBuffer(mediaData); |
140 | 140 test.expectEvent(sourceBuffer, "updateend"); |
141 // The 20 here is an arbitrary upper limit to make sure the test te rminates. This test | 141 test.waitForExpectedEvents(function() |
142 // assumes that implementations won't support more than 20 SourceBu ffers simultaneously. | 142 { |
143 for (var i = 0; i < 20; ++i) { | 143 assert_throws({name: "QuotaExceededError"}, |
144 try { | 144 function() { mediaSource.addSourceBuffer(MediaSourceUtil.A UDIO_VIDEO_TYPE); }, |
145 mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_VIDEO_TYP E); | 145 "addSourceBuffer must throw an exception if the MediaSourc e has already got some data"); |
146 } catch(e) { | 146 test.done(); |
147 assert_equals(e.name, "QuotaExceededError"); | 147 }); |
148 reachedLimit = true; | 148 }, "Test addSourceBuffer() throws QuotaExceededError after data has be en appended."); |
wolenetz
2016/09/13 21:03:14
nit: change this to be similar to the unit test: o
servolk
2016/09/14 18:15:27
Wait. First, there's only one sourceBuffer here, t
wolenetz
2016/09/14 23:31:21
I'm being a little pedantic here, but tests kind o
wolenetz
2016/09/14 23:34:28
mediasource-util.js includes a helper for this. Us
servolk
2016/09/15 00:18:32
Ah, ok, I see what you mean now. Done.
I guess we
| |
149 break; | |
150 } | |
151 } | |
152 assert_true(reachedLimit, "Reached SourceBuffer limit."); | |
153 test.done(); | |
154 }, "Test addSourceBuffer() QuotaExceededError."); | |
155 </script> | 149 </script> |
156 </body> | 150 </body> |
157 </html> | 151 </html> |
OLD | NEW |