Changeset 182942 in webkit
- Timestamp:
- Apr 17, 2015 3:03:35 AM (9 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r182941 r182942 1 2015-04-17 Youenn Fablet <youenn.fablet@crf.canon.fr> and Xabier Rodriguez Calvar <calvaris@igalia.com> 2 3 streams/reference-implementation/readable-stream.html is flaky 4 https://bugs.webkit.org/show_bug.cgi?id=143778 5 6 Unreviewed. 7 8 Comment out flaky subtests while working on a more complete 9 solution. 10 11 The problem with these tests is that they set a timeout before the 12 calling done() and this causes some tests to behave 13 undeterministically, specilly code related to promise 14 resolution. This could even cause indetermination if the tests 15 were expected to run correctly. 16 17 We think it is better to comment them out and find a more long 18 term solution that could involve submitting change requests to the 19 reference tests in the spec. This will be tackled in bug 143774. 20 21 * streams/reference-implementation/readable-stream-expected.txt: 22 * streams/reference-implementation/readable-stream-reader-expected.txt: 23 * streams/reference-implementation/readable-stream-reader.html: 24 * streams/reference-implementation/readable-stream-templated-expected.txt: 25 * streams/reference-implementation/readable-stream-templated.html: 26 * streams/reference-implementation/readable-stream.html: 27 1 28 2015-04-16 Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet <youenn.fablet@crf.canon.fr> 2 29 -
trunk/LayoutTests/streams/reference-implementation/readable-stream-expected.txt
r182783 r182942 11 11 PASS ReadableStream: if start throws an error, it should be re-thrown 12 12 FAIL ReadableStream: if pull rejects, it should error the stream read is not implemented 13 FAIL ReadableStream: should only call pull once upon starting the stream assert_equals: pull should be called once start finishes expected 1 but got 014 FAIL ReadableStream: should only call pull once for a forever-empty stream, even after reading read is not implemented15 FAIL ReadableStream: should only call pull once on a non-empty stream read from before start fulfills read is not implemented16 FAIL ReadableStream: should only call pull twice on a non-empty stream read from after start fulfills assert_equals: pull should be called once start finishes expected 1 but got 017 FAIL ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining assert_equals: pull should have been called once after read expected 1 but got 018 FAIL ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining assert_equals: pull should have been called once after read expected 1 but got 019 13 FAIL ReadableStream: should not call pull until the previous pull call's promise fulfills read is not implemented 20 FAIL ReadableStream: should pull after start, and after every read read is not implemented21 14 FAIL ReadableStream: should not call pull after start if the stream is now closed read is not implemented 22 15 FAIL ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows assert_equals: pull() should have been called four times expected 4 but got 0 -
trunk/LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt
r182797 r182942 14 14 TIMEOUT closed should be fulfilled after stream is closed (.closed access before acquiring) Test timed out 15 15 FAIL closed should be fulfilled after reader releases its lock (multiple stream locks) releaseLock is not implemented 16 FAIL Multiple readers can access the stream in sequence read is not implemented17 16 FAIL Cannot use an already-released reader to unlock a stream again releaseLock is not implemented 18 FAIL cancel() on a released reader is a no-op and does not pass through releaseLock is not implemented19 17 FAIL Getting a second reader after erroring the stream should succeed read is not implemented 20 18 -
trunk/LayoutTests/streams/reference-implementation/readable-stream-reader.html
r182783 r182942 191 191 }); 192 192 193 var test5 = async_test('Multiple readers can access the stream in sequence');194 test5.step(function() {195 var readCount = 0;196 var rs = new ReadableStream({197 start: function(c) {198 c.enqueue('a');199 c.enqueue('b');200 c.close();201 }202 });203 204 var reader1 = rs.getReader();205 reader1.read().then(test5.step_func(function(r) {206 assert_object_equals(r, { value: 'a', done: false }, 'reading the first chunk from reader1 works');207 ++readCount;208 }));209 reader1.releaseLock();210 211 var reader2 = rs.getReader();212 reader2.read().then(test5.step_func(function(r) {213 assert_object_equals(r, { value: 'b', done: false }, 'reading the second chunk from reader2 works');214 ++readCount;215 }));216 reader2.releaseLock();217 218 setTimeout(test5.step_func(function() {219 assert_equals(readCount, 2);220 test5.done();221 }), standardTimeout);222 });193 // var test5 = async_test('Multiple readers can access the stream in sequence'); 194 // test5.step(function() { 195 // var readCount = 0; 196 // var rs = new ReadableStream({ 197 // start: function(c) { 198 // c.enqueue('a'); 199 // c.enqueue('b'); 200 // c.close(); 201 // } 202 // }); 203 204 // var reader1 = rs.getReader(); 205 // reader1.read().then(test5.step_func(function(r) { 206 // assert_object_equals(r, { value: 'a', done: false }, 'reading the first chunk from reader1 works'); 207 // ++readCount; 208 // })); 209 // reader1.releaseLock(); 210 211 // var reader2 = rs.getReader(); 212 // reader2.read().then(test5.step_func(function(r) { 213 // assert_object_equals(r, { value: 'b', done: false }, 'reading the second chunk from reader2 works'); 214 // ++readCount; 215 // })); 216 // reader2.releaseLock(); 217 218 // setTimeout(test5.step_func(function() { 219 // assert_equals(readCount, 2); 220 // test5.done(); 221 // }), standardTimeout); 222 // }); 223 223 224 224 var test6 = async_test('Cannot use an already-released reader to unlock a stream again'); … … 242 242 }); 243 243 244 var test7 = async_test('cancel() on a released reader is a no-op and does not pass through');245 test7.step(function() {246 var readCounts = 0;247 var cancelled = false;248 var rs = new ReadableStream({249 start: function(c) {250 c.enqueue('a');251 },252 cancel: function() {253 assert_unreached('underlying source cancel should not be called');254 }255 });256 257 var reader = rs.getReader();258 reader.releaseLock();259 reader.cancel().then(test7.step_func(function(v) {260 assert_equals(v, undefined, 'cancel() on the reader should fulfill with undefined')261 cancelled = true;262 }));263 264 var reader2 = rs.getReader();265 reader2.read().then(test7.step_func(function(r) {266 assert_object_equals(r, { value: 'a', done: false }, 'a new reader should be able to read a chunk');267 ++readCounts;268 }));269 270 setTimeout(test7.step_func(function() {271 assert_true(cancelled);272 assert_equals(readCounts, 1);273 test7.done();274 }), standardTimeout);275 });244 // var test7 = async_test('cancel() on a released reader is a no-op and does not pass through'); 245 // test7.step(function() { 246 // var readCounts = 0; 247 // var cancelled = false; 248 // var rs = new ReadableStream({ 249 // start: function(c) { 250 // c.enqueue('a'); 251 // }, 252 // cancel: function() { 253 // assert_unreached('underlying source cancel should not be called'); 254 // } 255 // }); 256 257 // var reader = rs.getReader(); 258 // reader.releaseLock(); 259 // reader.cancel().then(test7.step_func(function(v) { 260 // assert_equals(v, undefined, 'cancel() on the reader should fulfill with undefined') 261 // cancelled = true; 262 // })); 263 264 // var reader2 = rs.getReader(); 265 // reader2.read().then(test7.step_func(function(r) { 266 // assert_object_equals(r, { value: 'a', done: false }, 'a new reader should be able to read a chunk'); 267 // ++readCounts; 268 // })); 269 270 // setTimeout(test7.step_func(function() { 271 // assert_true(cancelled); 272 // assert_equals(readCounts, 1); 273 // test7.done(); 274 // }), standardTimeout); 275 // }); 276 276 277 277 var test8 = async_test('Getting a second reader after erroring the stream should succeed'); -
trunk/LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt
r182797 r182942 4 4 PASS Running templatedRSEmptyReader with ReadableStream (empty) reader 5 5 PASS instances have the correct methods and properties 6 FAIL read() should never settle read is not implemented7 FAIL two read()s should both never settle read is not implemented8 6 FAIL read() should return distinct promises each time read is not implemented 9 7 PASS getReader() again on the stream should fail 10 FAIL releasing the lock with pending read requests should throw but the read requests should stay pending read is not implemented11 8 FAIL releasing the lock should cause further read() calls to resolve as if the stream is closed releaseLock is not implemented 12 9 FAIL releasing the lock should cause closed to fulfill releaseLock is not implemented … … 20 17 FAIL read() should fulfill with { value: undefined, done: true } read is not implemented 21 18 TIMEOUT closed should fulfill with undefined Test timed out 22 FAIL cancel() should return a distinct fulfilled promise each time cancel is not implemented23 19 PASS Running templatedRSClosed with ReadableStream (closed via cancel) 24 20 FAIL cancel() should return a distinct fulfilled promise each time cancel is not implemented … … 28 24 FAIL read() should fulfill with { value: undefined, done: true } cancel is not implemented 29 25 FAIL closed should fulfill with undefined cancel is not implemented 30 FAIL cancel() should return a distinct fulfilled promise each time cancel is not implemented31 26 PASS Running templatedRSErrored with ReadableStream (errored via call in start) 32 27 FAIL getReader() should return a reader that acts errored read is not implemented -
trunk/LayoutTests/streams/reference-implementation/readable-stream-templated.html
r182629 r182942 151 151 }, 'instances have the correct methods and properties'); 152 152 153 var test1 = async_test('read() should never settle');154 test1.step(function() {155 var { reader } = factory();156 157 reader.read().then(158 test1.step_func(function() { assert_unreached('read() should not fulfill'); }),159 test1.step_func(function() { assert_unreached('read() should not reject'); })160 );161 162 setTimeout(test1.step_func(function() { test1.done(); }), standardTimeout);163 });164 165 var test2 = async_test('two read()s should both never settle');166 test2.step(function() {167 var { reader } = factory();168 169 reader.read().then(170 test2.step_func(function() { assert_unreached('first read() should not fulfill'); }),171 test2.step_func(function() { assert_unreached('first read() should not reject'); })172 );173 174 reader.read().then(175 test2.step_func(function() { assert_unreached('second read() should not fulfill'); }),176 test2.step_func(function() { assert_unreached('second read() should not reject'); })177 );178 179 setTimeout(test2.step_func(function() { test2.done(); }), standardTimeout);180 });153 // var test1 = async_test('read() should never settle'); 154 // test1.step(function() { 155 // var { reader } = factory(); 156 157 // reader.read().then( 158 // test1.step_func(function() { assert_unreached('read() should not fulfill'); }), 159 // test1.step_func(function() { assert_unreached('read() should not reject'); }) 160 // ); 161 162 // setTimeout(test1.step_func(function() { test1.done(); }), standardTimeout); 163 // }); 164 165 // var test2 = async_test('two read()s should both never settle'); 166 // test2.step(function() { 167 // var { reader } = factory(); 168 169 // reader.read().then( 170 // test2.step_func(function() { assert_unreached('first read() should not fulfill'); }), 171 // test2.step_func(function() { assert_unreached('first read() should not reject'); }) 172 // ); 173 174 // reader.read().then( 175 // test2.step_func(function() { assert_unreached('second read() should not fulfill'); }), 176 // test2.step_func(function() { assert_unreached('second read() should not reject'); }) 177 // ); 178 179 // setTimeout(test2.step_func(function() { test2.done(); }), standardTimeout); 180 // }); 181 181 182 182 test(function() { … … 192 192 }, 'getReader() again on the stream should fail'); 193 193 194 var test3 = async_test('releasing the lock with pending read requests should throw but the read requests should stay pending');195 test3.step(function() {196 var { reader } = factory();197 198 reader.read().then(199 test3.step_func(function() { assert_unreached('first read() should not fulfill'); }),200 test3.step_func(function() { assert_unreached('first read() should not reject'); })201 );202 203 reader.read().then(204 test3.step_func(function() { assert_unreached('second read() should not fulfill'); }),205 test3.step_func(function() { assert_unreached('second read() should not reject'); })206 );207 208 reader.closed.then(209 test3.step_func(function() { assert_unreached('closed should not fulfill'); }),210 test3.step_func(function() { assert_unreached('closed should not reject'); })211 );212 213 assert_throws(new TypeError(), test3.step_func(function() { reader.releaseLock(); }, 'releaseLock should throw a TypeError'));214 215 setTimeout(test3.step_func(function() { test3.done(); }), standardTimeout);216 });194 // var test3 = async_test('releasing the lock with pending read requests should throw but the read requests should stay pending'); 195 // test3.step(function() { 196 // var { reader } = factory(); 197 198 // reader.read().then( 199 // test3.step_func(function() { assert_unreached('first read() should not fulfill'); }), 200 // test3.step_func(function() { assert_unreached('first read() should not reject'); }) 201 // ); 202 203 // reader.read().then( 204 // test3.step_func(function() { assert_unreached('second read() should not fulfill'); }), 205 // test3.step_func(function() { assert_unreached('second read() should not reject'); }) 206 // ); 207 208 // reader.closed.then( 209 // test3.step_func(function() { assert_unreached('closed should not fulfill'); }), 210 // test3.step_func(function() { assert_unreached('closed should not reject'); }) 211 // ); 212 213 // assert_throws(new TypeError(), test3.step_func(function() { reader.releaseLock(); }, 'releaseLock should throw a TypeError')); 214 215 // setTimeout(test3.step_func(function() { test3.done(); }), standardTimeout); 216 // }); 217 217 218 218 var test4 = async_test('releasing the lock should cause further read() calls to resolve as if the stream is closed'); … … 305 305 }); 306 306 307 var test3 = async_test('cancel() should return a distinct fulfilled promise each time');308 test3.step(function() {309 var { reader } = factory();310 var promiseCount = 0;311 312 var cancelPromise1 = reader.cancel();313 var cancelPromise2 = reader.cancel();314 var closedReaderPromise = reader.closed;315 316 cancelPromise1.then(test3.step_func(function(v) {317 assert_equals(v, undefined, 'first cancel() call should fulfill with undefined');318 ++promiseCount;319 }));320 cancelPromise2.then(test3.step_func(function(v) {321 assert_equals(v, undefined, 'second cancel() call should fulfill with undefined');322 ++promiseCount;323 }));324 assert_not_equals(cancelPromise1, cancelPromise2, 'cancel() calls should return distinct promises');325 assert_not_equals(cancelPromise1, closedReaderPromise, 'cancel() promise 1 should be distinct from reader.closed');326 assert_not_equals(cancelPromise2, closedReaderPromise, 'cancel() promise 2 should be distinct from reader.closed');327 328 setTimeout(test3.step_func(function() {329 assert_equals(promiseCount, 2);330 test3.done();331 }), standardTimeout);332 });307 // var test3 = async_test('cancel() should return a distinct fulfilled promise each time'); 308 // test3.step(function() { 309 // var { reader } = factory(); 310 // var promiseCount = 0; 311 312 // var cancelPromise1 = reader.cancel(); 313 // var cancelPromise2 = reader.cancel(); 314 // var closedReaderPromise = reader.closed; 315 316 // cancelPromise1.then(test3.step_func(function(v) { 317 // assert_equals(v, undefined, 'first cancel() call should fulfill with undefined'); 318 // ++promiseCount; 319 // })); 320 // cancelPromise2.then(test3.step_func(function(v) { 321 // assert_equals(v, undefined, 'second cancel() call should fulfill with undefined'); 322 // ++promiseCount; 323 // })); 324 // assert_not_equals(cancelPromise1, cancelPromise2, 'cancel() calls should return distinct promises'); 325 // assert_not_equals(cancelPromise1, closedReaderPromise, 'cancel() promise 1 should be distinct from reader.closed'); 326 // assert_not_equals(cancelPromise2, closedReaderPromise, 'cancel() promise 2 should be distinct from reader.closed'); 327 328 // setTimeout(test3.step_func(function() { 329 // assert_equals(promiseCount, 2); 330 // test3.done(); 331 // }), standardTimeout); 332 // }); 333 333 }; 334 334 -
trunk/LayoutTests/streams/reference-implementation/readable-stream.html
r182783 r182942 175 175 }); 176 176 177 var test5 = async_test('ReadableStream: should only call pull once upon starting the stream');178 test5.step(function() {179 var pullCount = 0;180 var startPromise = Promise.resolve();181 var rs = new ReadableStream({182 start: function() {183 return startPromise;184 },185 pull: function() {186 pullCount++;187 }188 });189 190 startPromise.then(test5.step_func(function() {191 assert_equals(pullCount, 1, 'pull should be called once start finishes');192 }));193 194 setTimeout(test5.step_func(function() {195 assert_equals(pullCount, 1, 'pull should be called exactly once');196 test5.done();197 }), standardTimeout);198 });199 200 var test6 = async_test('ReadableStream: should only call pull once for a forever-empty stream, even after reading');201 test6.step(function() {202 var pullCount = 0;203 var startPromise = Promise.resolve();204 var rs = new ReadableStream({205 start: function() {206 return startPromise;207 },208 pull: function() {209 pullCount++;210 }211 });212 213 startPromise.then(test6.step_func(function() {214 assert_equals(pullCount, 1, 'pull should be called once start finishes');215 }));216 217 rs.getReader().read();218 219 setTimeout(test6.step_func(function() {220 assert_equals(pullCount, 1, 'pull should be called exactly once');221 test6.done();222 }), standardTimeout);223 });224 225 var test7 = async_test('ReadableStream: should only call pull once on a non-empty stream read from before start fulfills');226 test7.step(function() {227 var pullCount = 0;228 var startPromise = Promise.resolve();229 var rs = new ReadableStream({230 start: function(c) {231 c.enqueue('a');232 return startPromise;233 },234 pull: function() {235 pullCount++;236 }237 });238 239 startPromise.then(test7.step_func(function() {240 assert_equals(pullCount, 1, 'pull should be called once start finishes');241 }));242 243 rs.getReader().read().then(test7.step_func(function(r) {244 assert_object_equals(r, { value: 'a', done: false }, 'first read() should return first chunk');245 assert_equals(pullCount, 1, 'pull should not have been called again');246 }));247 248 assert_equals(pullCount, 0, 'calling read() should not cause pull to be called yet');249 250 setTimeout(test7.step_func(function() {251 assert_equals(pullCount, 1, 'pull should be called exactly once');252 test7.done();253 }), standardTimeout);254 });255 256 var test8 = async_test('ReadableStream: should only call pull twice on a non-empty stream read from after start fulfills');257 test8.step(function() {258 var pullCount = 0;259 var startPromise = Promise.resolve();260 var rs = new ReadableStream({261 start: function(c) {262 c.enqueue('a');263 return startPromise;264 },265 pull: function() {266 pullCount++;267 }268 });269 270 startPromise.then(test8.step_func(function() {271 assert_equals(pullCount, 1, 'pull should be called once start finishes');272 273 rs.getReader().read().then(test8.step_func(function(r) {274 assert_object_equals(r, { value: 'a', done: false }, 'first read() should return first chunk');275 assert_equals(pullCount, 2, 'pull should be called again once read fulfills');276 }));277 }));278 279 assert_equals(pullCount, 0, 'calling read() should not cause pull to be called yet');280 281 setTimeout(test8.step_func(function() {282 assert_equals(pullCount, 2, 'pull should be called exactly twice')283 test8.done();284 }), standardTimeout);285 });286 287 var test9 = async_test('ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining');288 test9.step(function() {289 var pullCount = 0;290 var controller;291 var startPromise = Promise.resolve();292 var pullPromise = Promise.resolve();293 var rs = new ReadableStream({294 start: function(c) {295 controller = c;296 return startPromise;297 },298 pull: function() {299 ++pullCount;300 return pullPromise;301 }302 });303 304 var reader = rs.getReader();305 306 startPromise.then(test9.step_func(function() {307 assert_equals(pullCount, 1, 'pull should have been called once after read');308 309 controller.enqueue('a');310 311 return pullPromise.then(test9.step_func(function() {312 assert_equals(pullCount, 2, 'pull should have been called a second time after enqueue');313 314 return reader.read().then(test9.step_func(function() {315 assert_equals(pullCount, 3, 'pull should have been called a third time after read');316 }));317 }));318 })).catch(test9.step_func(function(e) {319 assert_unreached(e);320 }));321 322 setTimeout(test9.step_func(function() {323 assert_equals(pullCount, 3, 'pull should be called exactly thrice')324 test9.done();325 }), standardTimeout);326 });327 328 var test10 = async_test('ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining');329 test10.step(function() {330 var pullCount = 0;331 var controller;332 var startPromise = Promise.resolve();333 var pullPromise = Promise.resolve();334 var rs = new ReadableStream({335 start: function(c) {336 controller = c;337 return startPromise;338 },339 pull: function() {340 ++pullCount;341 return pullPromise;342 }343 });344 345 var reader = rs.getReader();346 347 startPromise.then(test10.step_func(function() {348 assert_equals(pullCount, 1, 'pull should have been called once after read');349 350 controller.enqueue('a');351 352 return pullPromise.then(test10.step_func(function() {353 assert_equals(pullCount, 2, 'pull should have been called a second time after enqueue');354 355 controller.close();356 357 return reader.read().then(test10.step_func(function() {358 assert_equals(pullCount, 2, 'pull should not have been called a third time after read');359 }));360 }));361 })).catch(test10.step_func(function(e) {362 assert_unreached(e)363 }));364 365 setTimeout(test10.step_func(function() {366 assert_equals(pullCount, 2, 'pull should be called exactly twice')367 test10.done();368 }), standardTimeout);369 });177 // var test5 = async_test('ReadableStream: should only call pull once upon starting the stream'); 178 // test5.step(function() { 179 // var pullCount = 0; 180 // var startPromise = Promise.resolve(); 181 // var rs = new ReadableStream({ 182 // start: function() { 183 // return startPromise; 184 // }, 185 // pull: function() { 186 // pullCount++; 187 // } 188 // }); 189 190 // startPromise.then(test5.step_func(function() { 191 // assert_equals(pullCount, 1, 'pull should be called once start finishes'); 192 // })); 193 194 // setTimeout(test5.step_func(function() { 195 // assert_equals(pullCount, 1, 'pull should be called exactly once'); 196 // test5.done(); 197 // }), standardTimeout); 198 // }); 199 200 // var test6 = async_test('ReadableStream: should only call pull once for a forever-empty stream, even after reading'); 201 // test6.step(function() { 202 // var pullCount = 0; 203 // var startPromise = Promise.resolve(); 204 // var rs = new ReadableStream({ 205 // start: function() { 206 // return startPromise; 207 // }, 208 // pull: function() { 209 // pullCount++; 210 // } 211 // }); 212 213 // startPromise.then(test6.step_func(function() { 214 // assert_equals(pullCount, 1, 'pull should be called once start finishes'); 215 // })); 216 217 // rs.getReader().read(); 218 219 // setTimeout(test6.step_func(function() { 220 // assert_equals(pullCount, 1, 'pull should be called exactly once'); 221 // test6.done(); 222 // }), standardTimeout); 223 // }); 224 225 // var test7 = async_test('ReadableStream: should only call pull once on a non-empty stream read from before start fulfills'); 226 // test7.step(function() { 227 // var pullCount = 0; 228 // var startPromise = Promise.resolve(); 229 // var rs = new ReadableStream({ 230 // start: function(c) { 231 // c.enqueue('a'); 232 // return startPromise; 233 // }, 234 // pull: function() { 235 // pullCount++; 236 // } 237 // }); 238 239 // startPromise.then(test7.step_func(function() { 240 // assert_equals(pullCount, 1, 'pull should be called once start finishes'); 241 // })); 242 243 // rs.getReader().read().then(test7.step_func(function(r) { 244 // assert_object_equals(r, { value: 'a', done: false }, 'first read() should return first chunk'); 245 // assert_equals(pullCount, 1, 'pull should not have been called again'); 246 // })); 247 248 // assert_equals(pullCount, 0, 'calling read() should not cause pull to be called yet'); 249 250 // setTimeout(test7.step_func(function() { 251 // assert_equals(pullCount, 1, 'pull should be called exactly once'); 252 // test7.done(); 253 // }), standardTimeout); 254 // }); 255 256 // var test8 = async_test('ReadableStream: should only call pull twice on a non-empty stream read from after start fulfills'); 257 // test8.step(function() { 258 // var pullCount = 0; 259 // var startPromise = Promise.resolve(); 260 // var rs = new ReadableStream({ 261 // start: function(c) { 262 // c.enqueue('a'); 263 // return startPromise; 264 // }, 265 // pull: function() { 266 // pullCount++; 267 // } 268 // }); 269 270 // startPromise.then(test8.step_func(function() { 271 // assert_equals(pullCount, 1, 'pull should be called once start finishes'); 272 273 // rs.getReader().read().then(test8.step_func(function(r) { 274 // assert_object_equals(r, { value: 'a', done: false }, 'first read() should return first chunk'); 275 // assert_equals(pullCount, 2, 'pull should be called again once read fulfills'); 276 // })); 277 // })); 278 279 // assert_equals(pullCount, 0, 'calling read() should not cause pull to be called yet'); 280 281 // setTimeout(test8.step_func(function() { 282 // assert_equals(pullCount, 2, 'pull should be called exactly twice') 283 // test8.done(); 284 // }), standardTimeout); 285 // }); 286 287 // var test9 = async_test('ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining'); 288 // test9.step(function() { 289 // var pullCount = 0; 290 // var controller; 291 // var startPromise = Promise.resolve(); 292 // var pullPromise = Promise.resolve(); 293 // var rs = new ReadableStream({ 294 // start: function(c) { 295 // controller = c; 296 // return startPromise; 297 // }, 298 // pull: function() { 299 // ++pullCount; 300 // return pullPromise; 301 // } 302 // }); 303 304 // var reader = rs.getReader(); 305 306 // startPromise.then(test9.step_func(function() { 307 // assert_equals(pullCount, 1, 'pull should have been called once after read'); 308 309 // controller.enqueue('a'); 310 311 // return pullPromise.then(test9.step_func(function() { 312 // assert_equals(pullCount, 2, 'pull should have been called a second time after enqueue'); 313 314 // return reader.read().then(test9.step_func(function() { 315 // assert_equals(pullCount, 3, 'pull should have been called a third time after read'); 316 // })); 317 // })); 318 // })).catch(test9.step_func(function(e) { 319 // assert_unreached(e); 320 // })); 321 322 // setTimeout(test9.step_func(function() { 323 // assert_equals(pullCount, 3, 'pull should be called exactly thrice') 324 // test9.done(); 325 // }), standardTimeout); 326 // }); 327 328 // var test10 = async_test('ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining'); 329 // test10.step(function() { 330 // var pullCount = 0; 331 // var controller; 332 // var startPromise = Promise.resolve(); 333 // var pullPromise = Promise.resolve(); 334 // var rs = new ReadableStream({ 335 // start: function(c) { 336 // controller = c; 337 // return startPromise; 338 // }, 339 // pull: function() { 340 // ++pullCount; 341 // return pullPromise; 342 // } 343 // }); 344 345 // var reader = rs.getReader(); 346 347 // startPromise.then(test10.step_func(function() { 348 // assert_equals(pullCount, 1, 'pull should have been called once after read'); 349 350 // controller.enqueue('a'); 351 352 // return pullPromise.then(test10.step_func(function() { 353 // assert_equals(pullCount, 2, 'pull should have been called a second time after enqueue'); 354 355 // controller.close(); 356 357 // return reader.read().then(test10.step_func(function() { 358 // assert_equals(pullCount, 2, 'pull should not have been called a third time after read'); 359 // })); 360 // })); 361 // })).catch(test10.step_func(function(e) { 362 // assert_unreached(e) 363 // })); 364 365 // setTimeout(test10.step_func(function() { 366 // assert_equals(pullCount, 2, 'pull should be called exactly twice') 367 // test10.done(); 368 // }), standardTimeout); 369 // }); 370 370 371 371 var test11 = async_test('ReadableStream: should not call pull until the previous pull call\'s promise fulfills'); … … 409 409 }); 410 410 411 var test12 = async_test('ReadableStream: should pull after start, and after every read');412 test12.step(function() {413 var timesCalled = 0;414 var startPromise = Promise.resolve();415 var rs = new ReadableStream({416 start: function(c) {417 c.enqueue('a');418 c.enqueue('b');419 c.enqueue('c');420 return startPromise;421 },422 pull: function() {423 ++timesCalled;424 },425 strategy: {426 size: function() {427 return 1;428 },429 shouldApplyBackpressure: function() {430 return false;431 }432 }433 });434 var reader = rs.getReader();435 436 startPromise.then(test12.step_func(function() {437 return reader.read().then(test12.step_func(function(result1) {438 assert_object_equals(result1, { value: 'a', done: false }, 'first chunk should be as expected');439 440 return reader.read().then(test12.step_func(function(result2) {441 assert_object_equals(result2, { value: 'b', done: false }, 'second chunk should be as expected');442 443 return reader.read().then(test12.step_func(function(result3) {444 assert_object_equals(result3, { value: 'c', done: false }, 'third chunk should be as expected');445 446 setTimeout(test12.step_func(function() {447 // Once for after start, and once for every read.448 assert_equals(timesCalled, 4, 'pull() should be called exactly four times');449 test12.done();450 }), standardTimeout);451 }));452 }));453 }));454 })).catch(test12.step_func(function(e) { assert_unreached(e); }));455 });411 // var test12 = async_test('ReadableStream: should pull after start, and after every read'); 412 // test12.step(function() { 413 // var timesCalled = 0; 414 // var startPromise = Promise.resolve(); 415 // var rs = new ReadableStream({ 416 // start: function(c) { 417 // c.enqueue('a'); 418 // c.enqueue('b'); 419 // c.enqueue('c'); 420 // return startPromise; 421 // }, 422 // pull: function() { 423 // ++timesCalled; 424 // }, 425 // strategy: { 426 // size: function() { 427 // return 1; 428 // }, 429 // shouldApplyBackpressure: function() { 430 // return false; 431 // } 432 // } 433 // }); 434 // var reader = rs.getReader(); 435 436 // startPromise.then(test12.step_func(function() { 437 // return reader.read().then(test12.step_func(function(result1) { 438 // assert_object_equals(result1, { value: 'a', done: false }, 'first chunk should be as expected'); 439 440 // return reader.read().then(test12.step_func(function(result2) { 441 // assert_object_equals(result2, { value: 'b', done: false }, 'second chunk should be as expected'); 442 443 // return reader.read().then(test12.step_func(function(result3) { 444 // assert_object_equals(result3, { value: 'c', done: false }, 'third chunk should be as expected'); 445 446 // setTimeout(test12.step_func(function() { 447 // // Once for after start, and once for every read. 448 // assert_equals(timesCalled, 4, 'pull() should be called exactly four times'); 449 // test12.done(); 450 // }), standardTimeout); 451 // })); 452 // })); 453 // })); 454 // })).catch(test12.step_func(function(e) { assert_unreached(e); })); 455 // }); 456 456 457 457 var test13 = async_test('ReadableStream: should not call pull after start if the stream is now closed');
Note: See TracChangeset
for help on using the changeset viewer.