OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 if (self.importScripts) { | 3 if (self.importScripts) { |
4 self.importScripts('../resources/test-utils.js'); | 4 self.importScripts('../resources/test-utils.js'); |
5 self.importScripts('../resources/rs-utils.js'); | 5 self.importScripts('../resources/rs-utils.js'); |
6 self.importScripts('/resources/testharness.js'); | 6 self.importScripts('/resources/testharness.js'); |
7 } | 7 } |
8 | 8 |
9 test(() => { | 9 test(() => { |
10 | 10 |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 rs.cancel(); | 726 rs.cancel(); |
727 assert_equals(startCalled, 1); | 727 assert_equals(startCalled, 1); |
728 assert_equals(pullCalled, 1); | 728 assert_equals(pullCalled, 1); |
729 assert_equals(cancelCalled, 1); | 729 assert_equals(cancelCalled, 1); |
730 return rs.getReader().closed; | 730 return rs.getReader().closed; |
731 }); | 731 }); |
732 | 732 |
733 }, 'ReadableStream: should call underlying source methods as methods'); | 733 }, 'ReadableStream: should call underlying source methods as methods'); |
734 | 734 |
735 test(() => { | 735 test(() => { |
| 736 const rs = new ReadableStream({ |
| 737 start(c) { |
| 738 assert_equals(c.desiredSize, 10, 'desiredSize must start at highWaterMark'
); |
| 739 c.close(); |
| 740 assert_equals(c.desiredSize, 0, 'after closing, desiredSize must be 0'); |
| 741 } |
| 742 }, { |
| 743 highWaterMark: 10 |
| 744 }); |
| 745 }, 'ReadableStream: desiredSize when closed'); |
| 746 |
| 747 test(() => { |
| 748 const rs = new ReadableStream({ |
| 749 start(c) { |
| 750 assert_equals(c.desiredSize, 10, 'desiredSize must start at highWaterMark'
); |
| 751 c.error(); |
| 752 assert_equals(c.desiredSize, null, 'after erroring, desiredSize must be nu
ll'); |
| 753 } |
| 754 }, { |
| 755 highWaterMark: 10 |
| 756 }); |
| 757 }, 'ReadableStream: desiredSize when errored'); |
| 758 |
| 759 test(() => { |
736 | 760 |
737 let startCalled = false; | 761 let startCalled = false; |
738 new ReadableStream({ | 762 new ReadableStream({ |
739 start(c) { | 763 start(c) { |
740 assert_equals(c.desiredSize, 1); | 764 assert_equals(c.desiredSize, 1); |
741 c.enqueue('a'); | 765 c.enqueue('a'); |
742 assert_equals(c.desiredSize, 0); | 766 assert_equals(c.desiredSize, 0); |
743 c.enqueue('b'); | 767 c.enqueue('b'); |
744 assert_equals(c.desiredSize, -1); | 768 assert_equals(c.desiredSize, -1); |
745 c.enqueue('c'); | 769 c.enqueue('c'); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 const rs = sequentialReadableStream(10, { async: true }); | 874 const rs = sequentialReadableStream(10, { async: true }); |
851 | 875 |
852 return readableStreamToArray(rs).then(chunks => { | 876 return readableStreamToArray(rs).then(chunks => { |
853 assert_true(rs.source.closed, 'source should be closed after all chunks are
read'); | 877 assert_true(rs.source.closed, 'source should be closed after all chunks are
read'); |
854 assert_array_equals(chunks, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'the expected 1
0 chunks should be read'); | 878 assert_array_equals(chunks, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'the expected 1
0 chunks should be read'); |
855 }); | 879 }); |
856 | 880 |
857 }, 'ReadableStream integration test: adapting an async pull source'); | 881 }, 'ReadableStream integration test: adapting an async pull source'); |
858 | 882 |
859 done(); | 883 done(); |
OLD | NEW |