OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>basic</title> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 |
| 10 <div id="container"></div> |
| 11 <pre id="console"></pre> |
| 12 |
| 13 <script> |
| 14 "use strict"; |
| 15 |
| 16 test(function () { |
| 17 assert_equals(internals.readableStream.constructor.name, "ReadableStream"); |
| 18 }, "internals.readableStream should be a ReadableStream"); |
| 19 |
| 20 promise_test(function () { |
| 21 const reader = internals.readableStream.getReader(); |
| 22 |
| 23 return reader.read().then(function (result1) { |
| 24 assert_equals(result1.value, "a"); |
| 25 assert_equals(result1.done, false); |
| 26 |
| 27 return reader.read(); |
| 28 }) |
| 29 .then(function (result2) { |
| 30 assert_equals(result2.value, "b"); |
| 31 assert_equals(result2.done, false); |
| 32 |
| 33 return reader.read(); |
| 34 }) |
| 35 .then(function (result3) { |
| 36 assert_equals(result3.value, undefined); |
| 37 assert_equals(result3.done, true); |
| 38 }); |
| 39 }, "reading from internals.readableStream should give the expected sequence"); |
| 40 |
| 41 </script> |
| 42 </body> |
| 43 |
| 44 </html> |
OLD | NEW |