summaryrefslogtreecommitdiff
path: root/test/sequential
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-05-13 17:42:22 +0200
committerAnatoli Papirovski <apapirovski@mac.com>2018-06-24 21:35:05 -0700
commit2930bd1317d15d12738a4896c0a6c05700411b47 (patch)
tree5c9225b9740c79d83ea2ded69d63b94a66846036 /test/sequential
parent6f63f8d730c8c3b19de7a591c35d376d428a4d56 (diff)
downloadandroid-node-v8-2930bd1317d15d12738a4896c0a6c05700411b47.tar.gz
android-node-v8-2930bd1317d15d12738a4896c0a6c05700411b47.tar.bz2
android-node-v8-2930bd1317d15d12738a4896c0a6c05700411b47.zip
src: refactor timers to remove TimerWrap
Refactor Timers to behave more similarly to Immediates by having a single uv_timer_t handle which is stored on the Environment. No longer expose timers in a public binding and instead make it part of the internalBinding. PR-URL: https://github.com/nodejs/node/pull/20894 Fixes: https://github.com/nodejs/node/issues/10154 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'test/sequential')
-rw-r--r--test/sequential/test-async-wrap-getasyncid.js6
-rw-r--r--test/sequential/test-timers-blocking-callback.js5
-rw-r--r--test/sequential/test-timers-set-interval-excludes-callback-duration.js5
3 files changed, 4 insertions, 12 deletions
diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js
index 002ffcffd8..cae156f790 100644
--- a/test/sequential/test-async-wrap-getasyncid.js
+++ b/test/sequential/test-async-wrap-getasyncid.js
@@ -256,12 +256,6 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
}
-{
- const TimerWrap = process.binding('timer_wrap').Timer;
- testInitialized(new TimerWrap(), 'Timer');
-}
-
-
if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check
const { TCP, constants: TCPConstants } = process.binding('tcp_wrap');
const tcp = new TCP(TCPConstants.SOCKET);
diff --git a/test/sequential/test-timers-blocking-callback.js b/test/sequential/test-timers-blocking-callback.js
index 435b69d1fa..3d05a538ea 100644
--- a/test/sequential/test-timers-blocking-callback.js
+++ b/test/sequential/test-timers-blocking-callback.js
@@ -25,7 +25,6 @@
const common = require('../common');
const assert = require('assert');
-const Timer = process.binding('timer_wrap').Timer;
const TIMEOUT = 100;
@@ -49,7 +48,7 @@ function blockingCallback(retry, callback) {
++nbBlockingCallbackCalls;
if (nbBlockingCallbackCalls > 1) {
- latestDelay = Timer.now() - timeCallbackScheduled;
+ latestDelay = Date.now() - timeCallbackScheduled;
// Even if timers can fire later than when they've been scheduled
// to fire, they shouldn't generally be more than 100% late in this case.
// But they are guaranteed to be at least 100ms late given the bug in
@@ -68,7 +67,7 @@ function blockingCallback(retry, callback) {
// block by busy-looping to trigger the issue
common.busyLoop(TIMEOUT);
- timeCallbackScheduled = Timer.now();
+ timeCallbackScheduled = Date.now();
setTimeout(blockingCallback.bind(null, retry, callback), TIMEOUT);
}
}
diff --git a/test/sequential/test-timers-set-interval-excludes-callback-duration.js b/test/sequential/test-timers-set-interval-excludes-callback-duration.js
index cb60d7e452..be9f491b92 100644
--- a/test/sequential/test-timers-set-interval-excludes-callback-duration.js
+++ b/test/sequential/test-timers-set-interval-excludes-callback-duration.js
@@ -1,6 +1,5 @@
'use strict';
const common = require('../common');
-const Timer = process.binding('timer_wrap').Timer;
const assert = require('assert');
let cntr = 0;
@@ -11,9 +10,9 @@ const t = setInterval(() => {
common.busyLoop(100);
// ensure that the event loop passes before the second interval
setImmediate(() => assert.strictEqual(cntr, 1));
- first = Timer.now();
+ first = Date.now();
} else if (cntr === 2) {
- assert(Timer.now() - first < 100);
+ assert(Date.now() - first < 100);
clearInterval(t);
}
}, 100);