11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst { OutgoingMessage } = require('http'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci{ 81cb0ef41Sopenharmony_ci // Tests for settimeout method with socket 91cb0ef41Sopenharmony_ci const expectedMsecs = 42; 101cb0ef41Sopenharmony_ci const outgoingMessage = new OutgoingMessage(); 111cb0ef41Sopenharmony_ci outgoingMessage.socket = { 121cb0ef41Sopenharmony_ci setTimeout: common.mustCall((msecs) => { 131cb0ef41Sopenharmony_ci assert.strictEqual(msecs, expectedMsecs); 141cb0ef41Sopenharmony_ci }) 151cb0ef41Sopenharmony_ci }; 161cb0ef41Sopenharmony_ci outgoingMessage.setTimeout(expectedMsecs); 171cb0ef41Sopenharmony_ci} 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci{ 201cb0ef41Sopenharmony_ci // Tests for settimeout method without socket 211cb0ef41Sopenharmony_ci const expectedMsecs = 23; 221cb0ef41Sopenharmony_ci const outgoingMessage = new OutgoingMessage(); 231cb0ef41Sopenharmony_ci outgoingMessage.setTimeout(expectedMsecs); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci outgoingMessage.emit('socket', { 261cb0ef41Sopenharmony_ci setTimeout: common.mustCall((msecs) => { 271cb0ef41Sopenharmony_ci assert.strictEqual(msecs, expectedMsecs); 281cb0ef41Sopenharmony_ci }) 291cb0ef41Sopenharmony_ci }); 301cb0ef41Sopenharmony_ci} 31