11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Regression test for https://github.com/nodejs/node-v0.x-archive/issues/8897. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// Test some private implementation details that should not be 61cb0ef41Sopenharmony_ci// considered public interface. 71cb0ef41Sopenharmony_ciconst common = require('../common'); 81cb0ef41Sopenharmony_ciconst timers = require('timers'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst foo = { 111cb0ef41Sopenharmony_ci _onTimeout: common.mustNotCall('_onTimeout should not be called') 121cb0ef41Sopenharmony_ci}; 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciconst bar = { 151cb0ef41Sopenharmony_ci _onTimeout: common.mustCall(function() { 161cb0ef41Sopenharmony_ci timers.unenroll(foo); 171cb0ef41Sopenharmony_ci }) 181cb0ef41Sopenharmony_ci}; 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci// We use timers with expiration times that are sufficiently apart to make 211cb0ef41Sopenharmony_ci// sure that they're not fired at the same time on platforms where the timer 221cb0ef41Sopenharmony_ci// resolution is a bit coarse (e.g Windows with a default resolution of ~15ms). 231cb0ef41Sopenharmony_citimers.enroll(bar, 1); 241cb0ef41Sopenharmony_citimers._unrefActive(bar); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_citimers.enroll(foo, 50); 271cb0ef41Sopenharmony_citimers._unrefActive(foo); 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ci// Keep the process open. 301cb0ef41Sopenharmony_cisetTimeout(() => {}, 100); 31