[Libreoffice-commits] core.git: framework/qa

Michael Meeks michael.meeks at collabora.com
Fri Jan 8 05:53:09 PST 2016


 framework/qa/complex/dispatches/Interceptor.java      |   10 +++-----
 framework/qa/complex/dispatches/checkdispatchapi.java |   22 ++++++++++++++----
 2 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit 3c47809a673c44575c08700d99b61549ebc9122b
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Jan 7 17:38:51 2016 +0000

    framework: re-enable two dispatch tests, and make them work harder.
    
    Change-Id: I63d72b2d8f0b4835ab0ead51b518deab635ff3b0
    Reviewed-on: https://gerrit.libreoffice.org/21222
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/framework/qa/complex/dispatches/Interceptor.java b/framework/qa/complex/dispatches/Interceptor.java
index bac4318..5ce13a5 100644
--- a/framework/qa/complex/dispatches/Interceptor.java
+++ b/framework/qa/complex/dispatches/Interceptor.java
@@ -160,8 +160,6 @@ public class Interceptor implements XDispatch,
      */
     public void checkNoSolarMutexHeld()
     {
-/*      disabled until the bugs here are fixed.
-
         try
         {
             if (m_xToolkit == null)
@@ -170,10 +168,12 @@ public class Interceptor implements XDispatch,
                     m_xMSF.createInstance("com.sun.star.awt.Toolkit"));
 
             // A Method notable only for taking the solar mutex.
+            System.out.println("Check solarmutex not held - if so deadlock");
             m_xToolkit.getDragSource( null );
+            System.out.println("Solarmutex not held.");
         } catch (java.lang.Throwable ex) {
-                System.out.println("Failed to createa and invoke toolkit method " + ex.toString());
-        } */
+                System.out.println("Failed to create and invoke toolkit method " + ex.toString());
+        }
     }
 
     /** XDispatchProvider
@@ -186,8 +186,6 @@ public class Interceptor implements XDispatch,
 
         checkNoSolarMutexHeld();
 
-        System.out.println("Interceptor.queryDispatch - re-entered successfully");
-
         if (impl_isBlockedURL(aURL.Complete))
         {
             System.out.println("Interceptor.queryDispatch(): URL blocked => returns NULL");
diff --git a/framework/qa/complex/dispatches/checkdispatchapi.java b/framework/qa/complex/dispatches/checkdispatchapi.java
index b55659c..74ee152 100644
--- a/framework/qa/complex/dispatches/checkdispatchapi.java
+++ b/framework/qa/complex/dispatches/checkdispatchapi.java
@@ -29,6 +29,8 @@ import com.sun.star.lang.XComponent;
 import com.sun.star.lang.XMultiServiceFactory;
 import com.sun.star.uno.UnoRuntime;
 import com.sun.star.util.XCloseable;
+import com.sun.star.awt.XReschedule;
+import com.sun.star.awt.XToolkitExperimental;
 import java.util.HashMap;
 
 import org.junit.After;
@@ -188,7 +190,7 @@ public class checkdispatchapi
         impl_checkDispatchInfo(aComponent);
     }
 
-    public void checkInterceptorLifeTime() throws Exception
+    @Test public void checkInterceptorLifeTime() throws Exception
     {
         // Note: It's important for the following test, that aInterceptor will be hold alive by the uno reference
         // xInterceptor. Otherwhise we can't check some internal states of aInterceptor at the end of this method, because
@@ -222,7 +224,7 @@ public class checkdispatchapi
         System.out.println("Destruction of interception chain works as designed .-)");
     }
 
-    public void checkInterception() throws Exception
+    @Test public void checkInterception() throws Exception
     {
         String[] lDisabledURLs = new String[] { ".uno:Open" };
 
@@ -234,13 +236,25 @@ public class checkdispatchapi
 
         System.out.println("create and initialize frame ...");
         XFrame xFrame = impl_createNewFrame();
-        impl_loadIntoFrame(xFrame, "private:factory/swriter", null);
 
         XDispatchProviderInterception xInterception = UnoRuntime.queryInterface(XDispatchProviderInterception.class, xFrame);
-
         System.out.println("register interceptor ...");
         xInterception.registerDispatchProviderInterceptor(xInterceptor);
 
+        impl_loadIntoFrame(xFrame, "private:factory/swriter", null);
+
+        // Framework dispatcher update is on a ~50ms wait.
+        Thread.sleep(100);
+
+        XReschedule m_xReschedule = UnoRuntime.queryInterface(
+            XReschedule.class, m_xMSF.createInstance("com.sun.star.awt.Toolkit"));
+        // queryDispatch for toolbars etc. happens asynchronously.
+        System.out.println("process deferred events ...");
+        m_xReschedule.reschedule();
+        XToolkitExperimental m_xIdles = UnoRuntime.queryInterface(
+            XToolkitExperimental.class, m_xReschedule);
+        m_xIdles.processEventsToIdle();
+
         System.out.println("deregister interceptor ...");
         xInterception.releaseDispatchProviderInterceptor(xInterceptor);
     }


More information about the Libreoffice-commits mailing list