Bug 1059572 - Part 0.5: Fixes for pre-existing problems in TestTimers. r=nfroyd
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 29 Jul 2015 11:43:40 -0500
changeset 286984 88854d602d98f67d4d7e541d41d9647373408d1f
parent 286983 d6ae2155496b0082ba76cf3c9cf531bd539d430d
child 286985 7793255f366e01dd38aac596d094c853bc6d94df
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1059572
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1059572 - Part 0.5: Fixes for pre-existing problems in TestTimers. r=nfroyd
xpcom/tests/TestTimers.cpp
--- a/xpcom/tests/TestTimers.cpp
+++ b/xpcom/tests/TestTimers.cpp
@@ -55,17 +55,17 @@ private:
   nsCOMPtr<nsIThread> mThread;
 };
 
 class AutoCreateAndDestroyReentrantMonitor
 {
 public:
   AutoCreateAndDestroyReentrantMonitor() {
     mReentrantMonitor = new ReentrantMonitor("TestTimers::AutoMon");
-    NS_ASSERTION(mReentrantMonitor, "Out of memory!");
+    MOZ_ASSERT(mReentrantMonitor, "Out of memory!");
   }
 
   ~AutoCreateAndDestroyReentrantMonitor() {
     delete mReentrantMonitor;
   }
 
   operator ReentrantMonitor* () {
     return mReentrantMonitor;
@@ -79,22 +79,22 @@ class TimerCallback final : public nsITi
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   TimerCallback(nsIThread** aThreadPtr, ReentrantMonitor* aReentrantMonitor)
   : mThreadPtr(aThreadPtr), mReentrantMonitor(aReentrantMonitor) { }
 
   NS_IMETHOD Notify(nsITimer* aTimer) override {
-    NS_ASSERTION(mThreadPtr, "Callback was not supposed to be called!");
+    MOZ_ASSERT(mThreadPtr, "Callback was not supposed to be called!");
     nsCOMPtr<nsIThread> current(do_GetCurrentThread());
 
     ReentrantMonitorAutoEnter mon(*mReentrantMonitor);
 
-    NS_ASSERTION(!*mThreadPtr, "Timer called back more than once!");
+    MOZ_ASSERT(!*mThreadPtr, "Timer called back more than once!");
     *mThreadPtr = current;
 
     mon.Notify();
 
     return NS_OK;
   }
 private:
   ~TimerCallback() {}
@@ -124,18 +124,17 @@ TestTargetedTimers()
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsIThread* notifiedThread = nullptr;
 
   nsCOMPtr<nsITimerCallback> callback =
     new TimerCallback(&notifiedThread, newMon);
   NS_ENSURE_TRUE(callback, NS_ERROR_OUT_OF_MEMORY);
 
-  rv = timer->InitWithCallback(callback, PR_MillisecondsToInterval(2000),
-                               nsITimer::TYPE_ONE_SHOT);
+  rv = timer->InitWithCallback(callback, 2000, nsITimer::TYPE_ONE_SHOT);
   NS_ENSURE_SUCCESS(rv, rv);
 
   ReentrantMonitorAutoEnter mon(*newMon);
   while (!notifiedThread) {
     mon.Wait();
   }
   NS_ENSURE_TRUE(notifiedThread == testThread, NS_ERROR_FAILURE);
 
@@ -157,18 +156,17 @@ TestTimerWithStoppedTarget()
   rv = timer->SetTarget(target);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If this is called, we'll assert
   nsCOMPtr<nsITimerCallback> callback =
     new TimerCallback(nullptr, nullptr);
   NS_ENSURE_TRUE(callback, NS_ERROR_OUT_OF_MEMORY);
 
-  rv = timer->InitWithCallback(callback, PR_MillisecondsToInterval(100),
-                               nsITimer::TYPE_ONE_SHOT);
+  rv = timer->InitWithCallback(callback, 100, nsITimer::TYPE_ONE_SHOT);
   NS_ENSURE_SUCCESS(rv, rv);
 
   testThread->Shutdown();
 
   PR_Sleep(400);
 
   return NS_OK;
 }