Bug 740769. (Av1) Fix multiple issues in test_bug325418.js. r=bzbarsky a=akeybl
authorSerge Gautherie <sgautherie.bz@free.fr>
Thu, 05 Apr 2012 22:59:38 +0200
changeset 90753 4c7f697b3697514f065f19f4149aaf09ebd1bc04
parent 90752 39dbe3601ed8b1db339f676871dbe072c3f0e774
child 90754 551fcc0596d1bdee0155731a43453b20b985978d
push id1119
push userjh@junetz.de
push dateMon, 23 Apr 2012 19:07:01 +0000
treeherdermozilla-aurora@551fcc0596d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, akeybl
bugs740769, 325418
milestone13.0a2
Bug 740769. (Av1) Fix multiple issues in test_bug325418.js. r=bzbarsky a=akeybl
xpcom/tests/unit/test_bug325418.js
--- a/xpcom/tests/unit/test_bug325418.js
+++ b/xpcom/tests/unit/test_bug325418.js
@@ -1,27 +1,26 @@
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 
 var timer;
 const start_time = (new Date()).getTime();
 const expected_time = 1;
 
 var observer = {
-  observe: function(subject, topic, data) {
+  observe: function observeTC(subject, topic, data) {
     if (topic == "timer-callback") {
-      var stop_time = (new Date()).getTime();
+      timer.cancel();
+      timer = null;
+
       // expected time may not be exact so convert to seconds and round down.
-      var result = Math.round((stop_time - start_time) / 1000);
-      do_check_true(result, expected_time);
+      var result = Math.floor(((new Date()).getTime() - start_time) / 1000);
+      do_check_eq(result, expected_time);
 
       do_test_finished();
-
-      timer.cancel();
-      timer = null;
     }
   }
 };
 
 function run_test() {
   do_test_pending();
 
   timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);