OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 if (self.importScripts) { | 3 if (self.importScripts) { |
4 self.importScripts('../resources/rs-utils.js'); | 4 self.importScripts('../resources/rs-utils.js'); |
5 self.importScripts('/resources/testharness.js'); | 5 self.importScripts('/resources/testharness.js'); |
6 } | 6 } |
7 | 7 |
8 const error1 = new Error('error1'); | 8 const error1 = new Error('error1'); |
9 error1.name = 'error1'; | 9 error1.name = 'error1'; |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 new ReadableStream({ | 93 new ReadableStream({ |
94 pull: t.unreached_func('pull() should not be called'), | 94 pull: t.unreached_func('pull() should not be called'), |
95 type: 'bytes' | 95 type: 'bytes' |
96 }, { | 96 }, { |
97 highWaterMark: 0 | 97 highWaterMark: 0 |
98 }); | 98 }); |
99 | 99 |
100 return Promise.resolve(); | 100 return Promise.resolve(); |
101 }, 'ReadableStream with byte source: Construct with highWaterMark of 0'); | 101 }, 'ReadableStream with byte source: Construct with highWaterMark of 0'); |
102 | 102 |
| 103 test(() => { |
| 104 const rs = new ReadableStream({ |
| 105 start(c) { |
| 106 assert_equals(c.desiredSize, 10, 'desiredSize must start at the highWaterM
ark'); |
| 107 c.close(); |
| 108 assert_equals(c.desiredSize, 0, 'after closing, desiredSize must be 0'); |
| 109 }, |
| 110 type: 'bytes' |
| 111 }, { |
| 112 highWaterMark: 10 |
| 113 }); |
| 114 }, 'ReadableStream with byte source: desiredSize when closed'); |
| 115 |
| 116 test(() => { |
| 117 const rs = new ReadableStream({ |
| 118 start(c) { |
| 119 assert_equals(c.desiredSize, 10, 'desiredSize must start at the highWaterM
ark'); |
| 120 c.error(); |
| 121 assert_equals(c.desiredSize, null, 'after erroring, desiredSize must be nu
ll'); |
| 122 }, |
| 123 type: 'bytes' |
| 124 }, { |
| 125 highWaterMark: 10 |
| 126 }); |
| 127 }, 'ReadableStream with byte source: desiredSize when errored'); |
| 128 |
103 promise_test(t => { | 129 promise_test(t => { |
104 const stream = new ReadableStream({ | 130 const stream = new ReadableStream({ |
105 type: 'bytes' | 131 type: 'bytes' |
106 }); | 132 }); |
107 | 133 |
108 const reader = stream.getReader(); | 134 const reader = stream.getReader(); |
109 reader.releaseLock(); | 135 reader.releaseLock(); |
110 | 136 |
111 return promise_rejects(t, new TypeError(), reader.closed, 'closed must reject'
); | 137 return promise_rejects(t, new TypeError(), reader.closed, 'closed must reject'
); |
112 }, 'ReadableStream with byte source: getReader(), then releaseLock()'); | 138 }, 'ReadableStream with byte source: getReader(), then releaseLock()'); |
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(stream), 'co
nstructor must throw'); | 1894 assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(stream), 'co
nstructor must throw'); |
1869 }, 'ReadableStreamBYOBReader constructor requires an unlocked ReadableStream'); | 1895 }, 'ReadableStreamBYOBReader constructor requires an unlocked ReadableStream'); |
1870 | 1896 |
1871 test(() => { | 1897 test(() => { |
1872 const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getRead
er({ mode: 'byob' }).constructor; | 1898 const ReadableStreamBYOBReader = new ReadableStream({ type: 'bytes' }).getRead
er({ mode: 'byob' }).constructor; |
1873 const stream = new ReadableStream(); | 1899 const stream = new ReadableStream(); |
1874 assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(stream), 'co
nstructor must throw'); | 1900 assert_throws(new TypeError(), () => new ReadableStreamBYOBReader(stream), 'co
nstructor must throw'); |
1875 }, 'ReadableStreamBYOBReader constructor requires a ReadableStream with type "by
tes"'); | 1901 }, 'ReadableStreamBYOBReader constructor requires a ReadableStream with type "by
tes"'); |
1876 | 1902 |
1877 done(); | 1903 done(); |
OLD | NEW |