You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/01/29 17:25:38 UTC
svn commit: r501089 -
/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TimerTaskTest.java
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)