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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/streams/piping/pipe-through.js

Issue 2642393002: Import wpt@40665266227e475bc4a56884247d8c09d78dfb6a (Closed)
Patch Set: rebaseline-cl Created 3 years, 11 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
(Empty)
1 'use strict';
2
3 if (self.importScripts) {
4 self.importScripts('/resources/testharness.js');
5 self.importScripts('../resources/rs-utils.js');
6 }
7
8 function duckTypedPassThroughTransform() {
9 let enqueueInReadable;
10 let closeReadable;
11
12 return {
13 writable: new WritableStream({
14 write(chunk) {
15 enqueueInReadable(chunk);
16 },
17
18 close() {
19 closeReadable();
20 }
21 }),
22
23 readable: new ReadableStream({
24 start(c) {
25 enqueueInReadable = c.enqueue.bind(c);
26 closeReadable = c.close.bind(c);
27 }
28 })
29 };
30 }
31
32 promise_test(() => {
33 const readableEnd = sequentialReadableStream(5).pipeThrough(duckTypedPassThrou ghTransform());
34
35 return readableStreamToArray(readableEnd).then(chunks =>
36 assert_array_equals(chunks, [1, 2, 3, 4, 5]), 'chunks should match');
37 }, 'Piping through a duck-typed pass-through transform stream should work');
38
39 done();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698