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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/streams/readable-streams/bad-underlying-sources.js

Issue 2668783003: Import wpt@767dc2a4f049c761bd146d61de2ea860a895a624 (Closed)
Patch Set: Update test expectations and baselines. Created 3 years, 10 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 'use strict'; 1 'use strict';
2 2
3 if (self.importScripts) { 3 if (self.importScripts) {
4 self.importScripts('/resources/testharness.js'); 4 self.importScripts('/resources/testharness.js');
5 } 5 }
6 6
7 7
8 test(() => { 8 test(() => {
9 9
10 const theError = new Error('a unique string'); 10 const theError = new Error('a unique string');
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 }).getReader().closed; 373 }).getReader().closed;
374 374
375 return closed.catch(e => { 375 return closed.catch(e => {
376 assert_true(startCalled); 376 assert_true(startCalled);
377 assert_equals(e, firstError, 'closed should reject with the first error'); 377 assert_equals(e, firstError, 'closed should reject with the first error');
378 }); 378 });
379 379
380 }, 'Underlying source: calling error and returning a rejected promise from pull should cause the stream to error ' + 380 }, 'Underlying source: calling error and returning a rejected promise from pull should cause the stream to error ' +
381 'with the first error'); 381 'with the first error');
382 382
383 const error1 = { name: 'error1' };
384
385 promise_test(t => {
386
387 let pullShouldThrow = false;
388 const rs = new ReadableStream({
389 pull(controller) {
390 if (pullShouldThrow) {
391 throw error1;
392 }
393 controller.enqueue(0);
394 }
395 }, new CountQueuingStrategy({highWaterMark: 1}));
396 const reader = rs.getReader();
397 return Promise.resolve().then(() => {
398 pullShouldThrow = true;
399 return Promise.all([
400 reader.read(),
401 promise_rejects(t, error1, reader.closed, '.closed promise should reject')
402 ]);
403 });
404
405 }, 'read should not error if it dequeues and pull() throws');
406
383 done(); 407 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698