mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Remove special Tinytest timer functions
This commit is contained in:
@@ -216,7 +216,7 @@ testAsyncMulti("livedata - compound methods", [
|
||||
var release = expect();
|
||||
onQuiesce(function () {
|
||||
checkBalances(test, 90, 60);
|
||||
Tinytest.defer(release);
|
||||
Meteor.defer(release);
|
||||
});
|
||||
},
|
||||
function (test, expect) {
|
||||
@@ -233,7 +233,7 @@ testAsyncMulti("livedata - compound methods", [
|
||||
var release = expect();
|
||||
onQuiesce(function () {
|
||||
checkBalances(test, 90, 60);
|
||||
Tinytest.defer(release);
|
||||
Meteor.defer(release);
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -287,7 +287,7 @@ Tinytest.addAsync("mongo-livedata - fuzz test", function(test, onComplete) {
|
||||
test.isTrue(max_counters[k] >= counters[k], k);
|
||||
});
|
||||
|
||||
Tinytest.defer(doStep);
|
||||
Meteor.defer(doStep);
|
||||
};
|
||||
|
||||
doStep();
|
||||
|
||||
@@ -2530,7 +2530,7 @@ testAsyncMulti(
|
||||
killLater(iframeDiv);
|
||||
});
|
||||
var checkLater = function(frameName, iframe, iframeDiv) {
|
||||
Tinytest.setTimeout(function() {
|
||||
Meteor.setTimeout(function() {
|
||||
check(iframe, iframeDiv);
|
||||
}, 500); // wait for frame to unload
|
||||
};
|
||||
|
||||
@@ -122,11 +122,11 @@ var testAsyncMulti = function (name, funcs) {
|
||||
onComplete();
|
||||
else {
|
||||
var em = new ExpectationManager(test, function () {
|
||||
Tinytest.clearTimeout(timer);
|
||||
Meteor.clearTimeout(timer);
|
||||
runNext();
|
||||
});
|
||||
|
||||
var timer = Tinytest.setTimeout(function () {
|
||||
var timer = Meteor.setTimeout(function () {
|
||||
if (em.cancel()) {
|
||||
test.fail({type: "timeout", message: "Async batch timed out"});
|
||||
onComplete();
|
||||
@@ -139,7 +139,7 @@ var testAsyncMulti = function (name, funcs) {
|
||||
} catch (exception) {
|
||||
if (em.cancel())
|
||||
test.exception(exception);
|
||||
Tinytest.clearTimeout(timer);
|
||||
Meteor.clearTimeout(timer);
|
||||
// Because we called test.exception, we're not to call onComplete.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ _.extend(TestCase.prototype, {
|
||||
onException(e);
|
||||
}, stop_at_offset);
|
||||
|
||||
Tinytest.defer(function () {
|
||||
Meteor.defer(function () {
|
||||
try {
|
||||
if (self.async) {
|
||||
self.func(results, function () {
|
||||
@@ -416,40 +416,7 @@ globals.Tinytest = {
|
||||
|
||||
addAsync: function (name, func) {
|
||||
TestManager.addCase(new TestCase(name, func, true));
|
||||
},
|
||||
|
||||
// Tinytest has versions of setTimeout et al. that preserve the
|
||||
// environment with write fence on the server. Unlike how
|
||||
// Meteor.setTimeout etc. are currently implemented, we *DO*
|
||||
// want to block method satisfaction.
|
||||
|
||||
setTimeout: function (f, duration) {
|
||||
return setTimeout(Meteor.bindEnvironment(f, function (e) {
|
||||
Meteor._debug("Exception from setTimeout callback:", e.stack);
|
||||
}), duration);
|
||||
},
|
||||
|
||||
setInterval: function (f, duration) {
|
||||
return setInterval(Meteor.bindEnvironment(f, function (e) {
|
||||
Meteor._debug("Exception from setInterval callback:", e);
|
||||
}), duration);
|
||||
},
|
||||
|
||||
clearInterval: function(x) {
|
||||
return clearInterval(x);
|
||||
},
|
||||
|
||||
clearTimeout: function(x) {
|
||||
return clearTimeout(x);
|
||||
},
|
||||
|
||||
defer: function (f) {
|
||||
// Older Firefox will pass an argument to the setTimeout callback
|
||||
// function, indicating the "actual lateness." It's non-standard,
|
||||
// so for defer, standardize on not having it.
|
||||
globals.Tinytest.setTimeout(function () {f();}, 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Run every test, asynchronously. Runs the test in the current
|
||||
|
||||
Reference in New Issue
Block a user