From 32d1a28f49fc85639e024b9f1d19367410422e96 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Fri, 20 Feb 2015 21:37:47 -0500 Subject: [PATCH] codan tests - removed sleeps and made sure it runs in non-ui thread Change-Id: Ic684e647ea43968c7da35e0f9448e01e66c06e8f --- .../ui/quickfix/QuickFixTestCase.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java index f7144b1f029..cae78762be4 100644 --- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java +++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixTestCase.java @@ -81,11 +81,17 @@ public abstract class QuickFixTestCase extends CheckerTestCase { @Override public void tearDown() throws CoreException { - IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages(); - for (IWorkbenchPage page : pages) { - page.closeAllEditors(false); - dispatch(200); - } + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages(); + for (IWorkbenchPage page : pages) { + page.closeAllEditors(false); + dispatch(0); + } + } + }); + super.tearDown(); } @@ -107,18 +113,23 @@ public abstract class QuickFixTestCase extends CheckerTestCase { // need to load before running codan because otherwise marker is lost when doing quick fix 8[] runCodan(); doRunQuickFix(); - dispatch(500); String result = TestUtils.loadFile(currentIFile.getContents()); return result; } public void doRunQuickFix() { - for (int i = 0; i < markers.length; i++) { - IMarker marker = markers[i]; - quickFix.run(marker); - dispatch(200); - } - PlatformUI.getWorkbench().saveAllEditors(false); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + for (int i = 0; i < markers.length; i++) { + IMarker marker = markers[i]; + quickFix.run(marker); + dispatch(0); + } + PlatformUI.getWorkbench().saveAllEditors(false); + } + }); + } /**