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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-appendwindow.html

Issue 2315113002: MSE: Throw TypeError instead of InvalidAccessError per spec update (Closed)
Patch Set: addSourceBuffer(null) is really addSourceBuffer("null") in at least Blink Created 4 years, 3 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
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>
(...skipping 26 matching lines...) Expand all
37 'set appendWindowStart throws an exception for Number.NEGATIVE _INFINITY.'); 37 'set appendWindowStart throws an exception for Number.NEGATIVE _INFINITY.');
38 38
39 assert_throws({name: 'TypeError'}, 39 assert_throws({name: 'TypeError'},
40 function() { sourceBuffer.appendWindowStart = Number.POSITIVE_ INFINITY; }, 40 function() { sourceBuffer.appendWindowStart = Number.POSITIVE_ INFINITY; },
41 'set appendWindowStart throws an exception for Number.POSITIVE _INFINITY.'); 41 'set appendWindowStart throws an exception for Number.POSITIVE _INFINITY.');
42 42
43 assert_throws({name: 'TypeError'}, 43 assert_throws({name: 'TypeError'},
44 function() { sourceBuffer.appendWindowStart = Number.NaN; }, 44 function() { sourceBuffer.appendWindowStart = Number.NaN; },
45 'set appendWindowStart throws an exception for Number.NaN.'); 45 'set appendWindowStart throws an exception for Number.NaN.');
46 46
47 assert_throws('InvalidAccessError', 47 assert_throws({name: 'TypeError'},
48 function() { sourceBuffer.appendWindowStart = 600.0; }, 48 function() { sourceBuffer.appendWindowStart = 600.0; },
49 'set appendWindowStart throws an exception when greater than a ppendWindowEnd.'); 49 'set appendWindowStart throws an exception when greater than a ppendWindowEnd.');
50 50
51 assert_throws('InvalidAccessError', 51 assert_throws({name: 'TypeError'},
52 function() { sourceBuffer.appendWindowStart = sourceBuffer.app endWindowEnd; }, 52 function() { sourceBuffer.appendWindowStart = sourceBuffer.app endWindowEnd; },
53 'set appendWindowStart throws an exception when equal to appen dWindowEnd.'); 53 'set appendWindowStart throws an exception when equal to appen dWindowEnd.');
54 54
55 assert_throws('InvalidAccessError', 55 assert_throws({name: 'TypeError'},
56 function() { sourceBuffer.appendWindowEnd = sourceBuffer.appen dWindowStart; }, 56 function() { sourceBuffer.appendWindowEnd = sourceBuffer.appen dWindowStart; },
57 'set appendWindowEnd throws an exception when equal to appendW indowStart.'); 57 'set appendWindowEnd throws an exception when equal to appendW indowStart.');
58 58
59 assert_throws('InvalidAccessError', 59 assert_throws({name: 'TypeError'},
60 function() { sourceBuffer.appendWindowEnd = sourceBuffer.appen dWindowStart - 1; }, 60 function() { sourceBuffer.appendWindowEnd = sourceBuffer.appen dWindowStart - 1; },
61 'set appendWindowEnd throws an exception if less than appendWi ndowStart.'); 61 'set appendWindowEnd throws an exception if less than appendWi ndowStart.');
62 62
63 assert_throws('InvalidAccessError', 63 assert_throws({name: 'TypeError'},
64 function() { sourceBuffer.appendWindowStart = -100.0; }, 64 function() { sourceBuffer.appendWindowStart = -100.0; },
65 'set appendWindowStart throws an exception when less than 0.') ; 65 'set appendWindowStart throws an exception when less than 0.') ;
66 66
67 assert_throws('InvalidAccessError', 67 assert_throws({name: 'TypeError'},
68 function() { sourceBuffer.appendWindowEnd = -100.0; }, 68 function() { sourceBuffer.appendWindowEnd = -100.0; },
69 'set appendWindowEnd throws an exception when less than 0.'); 69 'set appendWindowEnd throws an exception when less than 0.');
70 70
71 assert_throws('InvalidAccessError', 71 assert_throws({name: 'TypeError'},
72 function() { sourceBuffer.appendWindowEnd = Number.NaN; }, 72 function() { sourceBuffer.appendWindowEnd = Number.NaN; },
73 'set appendWindowEnd throws an exception if NaN.'); 73 'set appendWindowEnd throws an exception if NaN.');
74 74
75 assert_throws('InvalidAccessError', 75 assert_throws({name: 'TypeError'},
76 function() { sourceBuffer.appendWindowEnd = undefined; }, 76 function() { sourceBuffer.appendWindowEnd = undefined; },
77 'set appendWindowEnd throws an exception if undefined.'); 77 'set appendWindowEnd throws an exception if undefined.');
78 78
79 assert_throws({name: 'TypeError'}, 79 assert_throws({name: 'TypeError'},
80 function() { sourceBuffer.appendWindowStart = undefined; }, 80 function() { sourceBuffer.appendWindowStart = undefined; },
81 'set appendWindowStart throws an exception if undefined.'); 81 'set appendWindowStart throws an exception if undefined.');
82 82
83 test.done(); 83 test.done();
84 }, 'Test set wrong values to appendWindowStart and appendWindowEnd.'); 84 }, 'Test set wrong values to appendWindowStart and appendWindowEnd.');
85 85
86 mediasource_test(function(test, mediaElement, mediaSource) 86 mediasource_test(function(test, mediaElement, mediaSource)
87 { 87 {
88 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE); 88 var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUD IO_VIDEO_TYPE);
89 assert_true(sourceBuffer != null, 'New SourceBuffer returned'); 89 assert_true(sourceBuffer != null, 'New SourceBuffer returned');
90 90
91 sourceBuffer.appendWindowStart = ''; 91 sourceBuffer.appendWindowStart = '';
92 assert_true(sourceBuffer.appendWindowStart == 0, 'appendWindowStar t is 0'); 92 assert_true(sourceBuffer.appendWindowStart == 0, 'appendWindowStar t is 0');
93 93
94 sourceBuffer.appendWindowStart = '10'; 94 sourceBuffer.appendWindowStart = '10';
95 assert_true(sourceBuffer.appendWindowStart == 10, 'appendWindowSta rt is 10'); 95 assert_true(sourceBuffer.appendWindowStart == 10, 'appendWindowSta rt is 10');
96 96
97 sourceBuffer.appendWindowStart = null; 97 sourceBuffer.appendWindowStart = null;
98 assert_true(sourceBuffer.appendWindowStart == 0, 'appendWindowStar t is 0'); 98 assert_true(sourceBuffer.appendWindowStart == 0, 'appendWindowStar t is 0');
99 99
100 sourceBuffer.appendWindowStart = true; 100 sourceBuffer.appendWindowStart = true;
101 assert_true(sourceBuffer.appendWindowStart == 1, 'appendWindowStar t is 1'); 101 assert_true(sourceBuffer.appendWindowStart == 1, 'appendWindowStar t is 1');
102 102
103 sourceBuffer.appendWindowStart = false; 103 sourceBuffer.appendWindowStart = false;
104 assert_true(sourceBuffer.appendWindowStart == 0, 'appendWindowStar t is 0'); 104 assert_true(sourceBuffer.appendWindowStart == 0, 'appendWindowStar t is 0');
105 105
106 sourceBuffer.appendWindowEnd = '100'; 106 sourceBuffer.appendWindowEnd = '100';
107 assert_true(sourceBuffer.appendWindowEnd == 100, 'appendWindowEnd is 100'); 107 assert_true(sourceBuffer.appendWindowEnd == 100, 'appendWindowEnd is 100');
108 108
109 test.done(); 109 test.done();
110 110
111 }, 'Test set correct values to appendWindowStart and appendWindowEnd.' ); 111 }, 'Test set correct values to appendWindowStart and appendWindowEnd.' );
112 112
113 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData) 113 mediasource_testafterdataloaded(function(test, mediaElement, mediaSour ce, segmentInfo, sourceBuffer, mediaData)
114 { 114 {
115 mediaSource.removeSourceBuffer(sourceBuffer); 115 mediaSource.removeSourceBuffer(sourceBuffer);
116 assert_throws('InvalidStateError', 116 assert_throws('InvalidStateError',
117 function() { sourceBuffer.appendWindowStart = 100.0; }, 117 function() { sourceBuffer.appendWindowStart = 100.0; },
118 'set appendWindowStart throws an exception when mediasource ob ject is not associated with a buffer.'); 118 'set appendWindowStart throws an exception when mediasource ob ject is not associated with a buffer.');
119 119
120 assert_throws('InvalidStateError', 120 assert_throws('InvalidStateError',
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 'appendWindowStart is POSITIVE_INFINITY initially'); 169 'appendWindowStart is POSITIVE_INFINITY initially');
170 test.waitForExpectedEvents(function() 170 test.waitForExpectedEvents(function()
171 { 171 {
172 test.done(); 172 test.done();
173 }); 173 });
174 }, 'Test read appendWindowStart and appendWindowEnd initial values.'); 174 }, 'Test read appendWindowStart and appendWindowEnd initial values.');
175 175
176 </script> 176 </script>
177 </body> 177 </body>
178 </html> 178 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698