javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java | 14 +++------- 1 file changed, 5 insertions(+), 9 deletions(-)
New commits: commit 18ceb207ddd8e9065a8e0bd4a64163a3a2a0a0ce Author: Robert Antoni Buj i Gelonch <robert....@gmail.com> Date: Thu Oct 2 11:19:12 2014 +0200 javaunohelper: More robust way to wait for finalization Change-Id: I09fa2462d8131381f380574b8a9aeaf080211b2b Reviewed-on: https://gerrit.libreoffice.org/11759 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java index ef9fdbf..07200b6 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/WeakBase_Test.java @@ -34,6 +34,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import org.junit.Test; +import util.WaitUnreachable; public class WeakBase_Test { @@ -81,12 +82,9 @@ public class WeakBase_Test adapter.addReference(aRef2); assertSame(adapter.queryAdapted(), comp); + WaitUnreachable u = new WaitUnreachable(comp); comp= null; - logger.log(Level.FINE, "Wait 51ms (-XX:MaxGCPauseMillis=50)"); - System.gc(); - System.runFinalization(); - Thread.sleep(51); - + u.waitUnreachable(); assertEquals(aRef1.nDisposeCalled, 1); assertEquals(aRef2.nDisposeCalled, 1); assertNull(adapter.queryAdapted()); @@ -102,11 +100,9 @@ public class WeakBase_Test adapter.addReference(aRef2); adapter.removeReference(aRef1); - logger.log(Level.FINE, "Wait 51ms (-XX:MaxGCPauseMillis=50)"); + u = new WaitUnreachable(comp); comp= null; - System.gc(); - System.runFinalization(); - Thread.sleep(51); + u.waitUnreachable(); assertEquals(aRef1.nDisposeCalled, 0); assertEquals(aRef2.nDisposeCalled, 1); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits