mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Bug 740769. (Bv1) Convert test_bug325418.js file to LF end-of-lines, Fix nsITimer.idl documentation. r=bzbarsky.
DONTBUILD.
This commit is contained in:
parent
b6b17661cb
commit
f5cb497d42
@ -1,31 +1,31 @@
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var timer;
|
||||
const start_time = (new Date()).getTime();
|
||||
const expected_time = 1;
|
||||
|
||||
var observer = {
|
||||
observe: function observeTC(subject, topic, data) {
|
||||
if (topic == "timer-callback") {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
|
||||
// expected time may not be exact so convert to seconds and round down.
|
||||
var result = Math.floor(((new Date()).getTime() - start_time) / 1000);
|
||||
do_check_eq(result, expected_time);
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
// Start a 5 second timer, than cancel it and start a 1 second timer.
|
||||
timer.init(observer, 5000, timer.TYPE_REPEATING_PRECISE);
|
||||
timer.cancel();
|
||||
timer.init(observer, 1000, timer.TYPE_REPEATING_PRECISE);
|
||||
}
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var timer;
|
||||
const start_time = (new Date()).getTime();
|
||||
const expected_time = 1;
|
||||
|
||||
var observer = {
|
||||
observe: function observeTC(subject, topic, data) {
|
||||
if (topic == "timer-callback") {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
|
||||
// expected time may not be exact so convert to seconds and round down.
|
||||
var result = Math.floor(((new Date()).getTime() - start_time) / 1000);
|
||||
do_check_eq(result, expected_time);
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
// Start a 5 second timer, than cancel it and start a 1 second timer.
|
||||
timer.init(observer, 5000, timer.TYPE_REPEATING_PRECISE);
|
||||
timer.cancel();
|
||||
timer.init(observer, 1000, timer.TYPE_REPEATING_PRECISE);
|
||||
}
|
||||
|
@ -177,8 +177,7 @@ interface nsITimer : nsISupports
|
||||
|
||||
/**
|
||||
* Initialize a timer to fire after the given millisecond interval.
|
||||
* This version takes a function to call and a closure to pass to
|
||||
* that function.
|
||||
* This version takes a function to call.
|
||||
*
|
||||
* @param aFunc nsITimerCallback interface to call when timer expires
|
||||
* @param aDelay The millisecond interval
|
||||
|
Loading…
x
Reference in New Issue
Block a user