Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-remove.html

Issue 266453005: Apply TypeChecking to MediaSource IDLs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use MAX_VALUE instead of POS_INF. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-remove-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 assert_throws("InvalidAccessError", function()
17 { 17 {
18 sourceBuffer.remove(-1, 2); 18 sourceBuffer.remove(-1, 2);
19 }, "remove"); 19 }, "remove");
20 20
21 test.done(); 21 test.done();
22 }, "Test remove with an negative start."); 22 }, "Test remove with an negative start.");
23 23
24 mediasource_test(function(test, mediaElement, mediaSource)
25 {
26 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE);
27
28 [ undefined, NaN, Infinity, -Infinity ].forEach(function(item)
29 {
30 assert_throws(new TypeError(), function()
31 {
32 sourceBuffer.remove(item, 2);
33 }, "remove");
34 });
35
36 test.done();
37 }, "Test remove with non-finite start.");
24 38
25 mediasource_test(function(test, mediaElement, mediaSource) 39 mediasource_test(function(test, mediaElement, mediaSource)
26 { 40 {
27 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); 41 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE);
28 42
29 mediaSource.duration = 10; 43 mediaSource.duration = 10;
30 44
31 assert_throws("InvalidAccessError", function() 45 assert_throws("InvalidAccessError", function()
32 { 46 {
33 sourceBuffer.remove(11, 12); 47 sourceBuffer.remove(11, 12);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 188
175 test.waitForExpectedEvents(function() 189 test.waitForExpectedEvents(function()
176 { 190 {
177 assertBufferedEquals(sourceBuffer, expected, "Buffered ranges after remove()."); 191 assertBufferedEquals(sourceBuffer, expected, "Buffered ranges after remove().");
178 test.done(); 192 test.done();
179 }); 193 });
180 } 194 }
181 195
182 removeAppendedDataTests(function(test, sourceBuffer, bufferedRangeEnd, subType) 196 removeAppendedDataTests(function(test, sourceBuffer, bufferedRangeEnd, subType)
183 { 197 {
184 removeAndCheckBufferedRanges(test, sourceBuffer, 0, Number.POSITIV E_INFINITY, "{ }"); 198 // Using MAX_VALUE rather than POSITIVE_INFINITY here due to lack
199 // of 'unrestricted' on end parameter. (See comment in SourceBuffe r.idl)
200 removeAndCheckBufferedRanges(test, sourceBuffer, 0, Number.MAX_VAL UE, "{ }");
185 }, "Test removing all appended data."); 201 }, "Test removing all appended data.");
186 202
187 removeAppendedDataTests(function(test, sourceBuffer, bufferedRangeEnd, subType) 203 removeAppendedDataTests(function(test, sourceBuffer, bufferedRangeEnd, subType)
188 { 204 {
189 var expectations = { 205 var expectations = {
190 webm: ("{ [3.187, " + bufferedRangeEnd + ") }"), 206 webm: ("{ [3.187, " + bufferedRangeEnd + ") }"),
191 mp4: ("{ [3.021, " + bufferedRangeEnd + ") }"), 207 mp4: ("{ [3.021, " + bufferedRangeEnd + ") }"),
192 }; 208 };
193 209
194 // Note: Range doesn't start exactly at the end of the remove rang e because there isn't 210 // Note: Range doesn't start exactly at the end of the remove rang e because there isn't
(...skipping 14 matching lines...) Expand all
209 removeAndCheckBufferedRanges(test, sourceBuffer, 1, 3, expectation s[subType]); 225 removeAndCheckBufferedRanges(test, sourceBuffer, 1, 3, expectation s[subType]);
210 }, "Test removing the middle of appended data."); 226 }, "Test removing the middle of appended data.");
211 227
212 removeAppendedDataTests(function(test, sourceBuffer, bufferedRangeEnd, subType) 228 removeAppendedDataTests(function(test, sourceBuffer, bufferedRangeEnd, subType)
213 { 229 {
214 var expectations = { 230 var expectations = {
215 webm: "{ [0.000, 1.012) }", 231 webm: "{ [0.000, 1.012) }",
216 mp4: "{ [0.000, 1.022) }", 232 mp4: "{ [0.000, 1.022) }",
217 }; 233 };
218 234
219 removeAndCheckBufferedRanges(test, sourceBuffer, 1, Number.POSITIV E_INFINITY, expectations[subType]); 235 // Using MAX_VALUE rather than POSITIVE_INFINITY here due to lack
236 // of 'unrestricted' on end parameter. (See comment in SourceBuffe r.idl)
237 removeAndCheckBufferedRanges(test, sourceBuffer, 1, Number.MAX_VAL UE, expectations[subType]);
220 }, "Test removing the end of appended data."); 238 }, "Test removing the end of appended data.");
221 </script> 239 </script>
222 </body> 240 </body>
223 </html> 241 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-remove-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698