summaryrefslogtreecommitdiff
path: root/framework/qa/complex/dispatches
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2016-01-07 17:38:51 +0000
committerMichael Meeks <michael.meeks@collabora.com>2016-01-08 13:52:47 +0000
commit3c47809a673c44575c08700d99b61549ebc9122b (patch)
tree3e0cb1c5e85b72ce9f1c8c9a576482111da08502 /framework/qa/complex/dispatches
parentf2f1f52d8b84ac088496a4964d799bb84007fc45 (diff)
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@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'framework/qa/complex/dispatches')
-rw-r--r--framework/qa/complex/dispatches/Interceptor.java10
-rw-r--r--framework/qa/complex/dispatches/checkdispatchapi.java22
2 files changed, 22 insertions, 10 deletions
diff --git a/framework/qa/complex/dispatches/Interceptor.java b/framework/qa/complex/dispatches/Interceptor.java
index bac43188ac81..5ce13a52bb66 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 b55659c23eac..74ee152c9be8 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);
}