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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/streams/readable-streams/general.js

Issue 2561443004: Implementation of ReadableStream pipeTo and pipeThrough (Closed)
Patch Set: Rebase and move includes to .gn 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/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 19 matching lines...) Expand all
30 'constructor should throw when the type is null'); 30 'constructor should throw when the type is null');
31 assert_throws(new RangeError(), () => new ReadableStream({ type: '' }), 31 assert_throws(new RangeError(), () => new ReadableStream({ type: '' }),
32 'constructor should throw when the type is empty string'); 32 'constructor should throw when the type is empty string');
33 assert_throws(new RangeError(), () => new ReadableStream({ type: 'asdf' }), 33 assert_throws(new RangeError(), () => new ReadableStream({ type: 'asdf' }),
34 'constructor should throw when the type is asdf'); 34 'constructor should throw when the type is asdf');
35 35
36 }, 'ReadableStream can\'t be constructed with an invalid type'); 36 }, 'ReadableStream can\'t be constructed with an invalid type');
37 37
38 test(() => { 38 test(() => {
39 39
40 const methods = ['cancel', 'constructor', 'getReader', 'tee']; 40 const methods = ['cancel', 'constructor', 'getReader', 'pipeThrough', 'pipeTo' , 'tee'];
41 const properties = methods.concat(['locked']).sort(); 41 const properties = methods.concat(['locked']).sort();
42 42
43 const rs = new ReadableStream(); 43 const rs = new ReadableStream();
44 const proto = Object.getPrototypeOf(rs); 44 const proto = Object.getPrototypeOf(rs);
45 45
46 assert_array_equals(Object.getOwnPropertyNames(proto).sort(), properties, 'sho uld have all the correct methods'); 46 assert_array_equals(Object.getOwnPropertyNames(proto).sort(), properties, 'sho uld have all the correct methods');
47 47
48 for (const m of methods) { 48 for (const m of methods) {
49 const propDesc = Object.getOwnPropertyDescriptor(proto, m); 49 const propDesc = Object.getOwnPropertyDescriptor(proto, m);
50 assert_false(propDesc.enumerable, 'method should be non-enumerable'); 50 assert_false(propDesc.enumerable, 'method should be non-enumerable');
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 const rs = sequentialReadableStream(10, { async: true }); 844 const rs = sequentialReadableStream(10, { async: true });
845 845
846 return readableStreamToArray(rs).then(chunks => { 846 return readableStreamToArray(rs).then(chunks => {
847 assert_true(rs.source.closed, 'source should be closed after all chunks are read'); 847 assert_true(rs.source.closed, 'source should be closed after all chunks are read');
848 assert_array_equals(chunks, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'the expected 1 0 chunks should be read'); 848 assert_array_equals(chunks, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'the expected 1 0 chunks should be read');
849 }); 849 });
850 850
851 }, 'ReadableStream integration test: adapting an async pull source'); 851 }, 'ReadableStream integration test: adapting an async pull source');
852 852
853 done(); 853 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698