11cb0ef41Sopenharmony_ci// Flags: --expose-internals 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cirequire('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst WrapStream = require('internal/js_stream_socket'); 71cb0ef41Sopenharmony_ciconst Stream = require('stream'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciclass FakeStream extends Stream { 101cb0ef41Sopenharmony_ci constructor() { 111cb0ef41Sopenharmony_ci super(); 121cb0ef41Sopenharmony_ci this._paused = false; 131cb0ef41Sopenharmony_ci } 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci pause() { 161cb0ef41Sopenharmony_ci this._paused = true; 171cb0ef41Sopenharmony_ci } 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci resume() { 201cb0ef41Sopenharmony_ci this._paused = false; 211cb0ef41Sopenharmony_ci } 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci isPaused() { 241cb0ef41Sopenharmony_ci return this._paused; 251cb0ef41Sopenharmony_ci } 261cb0ef41Sopenharmony_ci} 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ciconst fakeStreamObj = new FakeStream(); 291cb0ef41Sopenharmony_ciconst wrappedStream = new WrapStream(fakeStreamObj); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci// Resume by wrapped stream upon construction 321cb0ef41Sopenharmony_ciassert.strictEqual(fakeStreamObj.isPaused(), false); 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_cifakeStreamObj.pause(); 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ciassert.strictEqual(fakeStreamObj.isPaused(), true); 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_cifakeStreamObj.resume(); 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ciassert.strictEqual(wrappedStream.readStop(), 0); 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ciassert.strictEqual(fakeStreamObj.isPaused(), true); 43