Changeset 190159 in webkit
- Timestamp:
- Sep 23, 2015 4:03:08 AM (9 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r190158 r190159 1 2015-09-23 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 3 [Streams API] Add bad strategies writable streams tests 4 https://bugs.webkit.org/show_bug.cgi?id=148300 5 6 Reviewed by Darin Adler. 7 8 * streams/reference-implementation/bad-strategies-expected.txt: Added new expectations. 9 * streams/reference-implementation/bad-strategies.html: Added new writable stream tests. 10 1 11 2015-09-23 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 12 -
trunk/LayoutTests/streams/reference-implementation/bad-strategies-expected.txt
r186112 r190159 6 6 PASS Readable stream: negative strategy.highWaterMark 7 7 PASS Readable stream: invalid strategy.size return value 8 FAIL Writable stream: throwing strategy.size getter assert_throws: construction should re-throw the error function "function () { 9 new WritableStream({}, { 10 ..." threw object "ReferenceError: Can't find variable: WritableStream" ("ReferenceError") expected object "Error: a unique string" ("Error") 11 FAIL Writable stream: throwing strategy.size method Can't find variable: WritableStream 12 FAIL Writable stream: invalid strategy.size return value Can't find variable: WritableStream 13 FAIL Writable stream: throwing strategy.highWaterMark getter assert_throws: construction should re-throw the error function "function () { 14 new WritableStream({}, { 15 ..." threw object "ReferenceError: Can't find variable: WritableStream" ("ReferenceError") expected object "Error: a unique string" ("Error") 16 FAIL Writable stream: invalid strategy.highWaterMark assert_throws: construction should throw a RangeError for -1 function "function () { 17 new WritableStream({}, { 18 ..." threw object "ReferenceError: Can't find variable: WritableStream" ("ReferenceError") expected object "RangeError" ("RangeError") 19 FAIL Writable stream: negative strategy.highWaterMark assert_throws: construction should throw a RangeError function "function () { 20 new WritableStream({}, { 21 ..." threw object "ReferenceError: Can't find variable: WritableStream" ("ReferenceError") expected object "RangeError" ("RangeError") 8 22 -
trunk/LayoutTests/streams/reference-implementation/bad-strategies.html
r186112 r190159 123 123 } 124 124 }); 125 126 test(function() { 127 var theError = new Error('a unique string'); 128 129 assert_throws(theError, function() { 130 new WritableStream({}, { 131 get size() { 132 throw theError; 133 }, 134 highWaterMark: 5 135 }); 136 }, 'construction should re-throw the error'); 137 }, 'Writable stream: throwing strategy.size getter'); 138 139 var test3 = async_test('Writable stream: throwing strategy.size method'); 140 test3.step(function() { 141 var theError = new Error('a unique string'); 142 var writeCalled = false; 143 var ws = new WritableStream({ }, 144 { 145 size: function() { 146 throw theError; 147 }, 148 highWaterMark: 5 149 } 150 ); // Initial construction should not throw. 151 152 ws.write('a').then( 153 test3.step_func(function() { assert_unreached('write should not fulfill'); }), 154 test3.step_func(function(r) { 155 assert_equals(r, theError, 'write should reject with the thrown error'); 156 writeCalled = true; 157 }) 158 ); 159 160 ws.closed.then( 161 test3.step_func(function() { assert_unreached('closed should not fulfill'); }), 162 test3.step_func(function(r) { 163 assert_equals(r, theError, 'closed should reject with the thrown error'); 164 assert_true(writeCalled); 165 test3.done(); 166 }) 167 ); 168 }); 169 170 var test4 = async_test('Writable stream: invalid strategy.size return value'); 171 test4.step(function() { 172 var numberOfCalls = 0; 173 var elements = [NaN, -Infinity, +Infinity, -1]; 174 var theError = []; 175 var numberOfCalls = 0; 176 for (var i = 0; i < elements.length; i++) { 177 var ws = new WritableStream({}, 178 { 179 size: function() { 180 return elements[i]; 181 }, 182 highWaterMark: 5 183 }); 184 185 var writeFunction = function(i, r) { 186 assert_throws(new RangeError(), function() { throw r; }, 'write should reject with a RangeError for ' + elements[i]); 187 theError[i] = r; 188 }; 189 ws.write('a').then( 190 test4.step_func(function() { assert_unreached('write should not fulfill'); }), 191 test4.step_func(writeFunction.bind(this, i)) 192 ); 193 194 var catchFunction = function(i, e) { 195 assert_equals(e, theError[i], 'closed should reject with the error for ' + elements[i]); 196 if (++numberOfCalls, elements.length) { 197 test4.done(); 198 } 199 }; 200 201 ws.closed.catch(test4.step_func(catchFunction.bind(this, i))); 202 } 203 }); 204 205 test(function() { 206 var theError = new Error('a unique string'); 207 208 assert_throws(theError, function() { 209 new WritableStream({}, { 210 size: function() { 211 return 1; 212 }, 213 get highWaterMark() { 214 throw theError; 215 } 216 }); 217 }, 'construction should re-throw the error'); 218 }, 'Writable stream: throwing strategy.highWaterMark getter'); 219 220 test(function() { 221 for (var highWaterMark of [-1, -Infinity]) { 222 assert_throws(new RangeError(), function() { 223 new WritableStream({}, { 224 size: function() { 225 return 1; 226 }, 227 highWaterMark 228 }); 229 }, 'construction should throw a RangeError for ' + highWaterMark); 230 } 231 232 for (var highWaterMark of [NaN, 'foo', {}]) { 233 assert_throws(new TypeError(), function() { 234 new WritableStream({}, { 235 size: function() { 236 return 1; 237 }, 238 highWaterMark 239 }); 240 }, 'construction should throw a TypeError for ' + highWaterMark); 241 } 242 }, 'Writable stream: invalid strategy.highWaterMark'); 243 244 test(function() { 245 assert_throws(new RangeError(), function() { 246 new WritableStream({}, { 247 size: function() { 248 return 1; 249 }, 250 highWaterMark: -1 251 }); 252 }, 'construction should throw a RangeError'); 253 }, 'Writable stream: negative strategy.highWaterMark'); 125 254 </script>
Note: See TracChangeset
for help on using the changeset viewer.