harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r501089 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java
Date Mon, 29 Jan 2007 16:25:38 GMT
Author: tellison
Date: Mon Jan 29 08:25:37 2007
New Revision: 501089

URL: http://svn.apache.org/viewvc?view=rev&rev=501089
Log:
Apply patch HARMONY-3036 ([classlib][luni]tests.api.java.util.TimerTaskTest has unstable tests
in test_cancel() and test_run())

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java?view=diff&rev=501089&r1=501088&r2=501089
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java
Mon Jan 29 08:25:37 2007
@@ -126,10 +126,13 @@
 			t = new Timer();
 			testTask = new TimerTestTask();
 			t.schedule(testTask, 50);
-			try {
-				Thread.sleep(150);
-			} catch (InterruptedException e) {
-			}
+            while (testTask.wasRun <= 0) {
+                try {
+                    Thread.sleep(150);
+                } catch (InterruptedException e) {
+                }
+            }
+            
 			assertTrue(
 					"TimerTask.cancel() should return false if task has run",
 					!testTask.cancel());
@@ -294,13 +297,12 @@
 			t = new Timer();
 			testTask = new TimerTestTask();
 			t.schedule(testTask, 50, 50);
+            
+            while(testTask.wasRun() <= 4)
 			try {
 				Thread.sleep(400);
 			} catch (InterruptedException e) {
-			}
-			assertTrue(
-					"TimerTask.run() method should have been called at least 4 times",
-					testTask.wasRun() >= 4);
+			}			
 			t.cancel();
 		} finally {
 			if (t != null)



Mime
View raw message