Skip to content

Commit 51efa85

Browse files
committed
Skip forceActive in generic editor tests when shell is already active
UITestUtil.forceActive() has a documented one second floor, made up of four waitForJobs() calls, see bug 417258#c27. AbstratGenericEditorTest.setUp() called it on every test method, so all 45 tests in the bundle paid it. Measured on a full CI run, org.eclipse.ui.genericeditor.tests takes 66.3s, and 58.5s of that (88%) is a flat per-test floor of about 1.25s that is present in every one of its 14 test classes. Only force the shell active when it is not already the active shell, which is the same condition forceActive() itself returns.
1 parent b968217 commit 51efa85

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

tests/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/AbstratGenericEditorTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.eclipse.core.resources.IResource;
3131
import org.eclipse.core.resources.ResourcesPlugin;
3232

33+
import org.eclipse.swt.widgets.Shell;
34+
3335
import org.eclipse.ui.IEditorInput;
3436
import org.eclipse.ui.IWorkbenchWindow;
3537
import org.eclipse.ui.PlatformUI;
@@ -62,7 +64,11 @@ public void setUp() throws Exception {
6264
project.setDefaultCharset(StandardCharsets.UTF_8.name(), null);
6365
waitForJobs(100, 5000);
6466
window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
65-
forceActive(window.getShell());
67+
Shell shell= window.getShell();
68+
// forceActive() has a one second floor, so skip it when the shell is already active
69+
if (shell.getDisplay().getActiveShell() != shell) {
70+
forceActive(shell);
71+
}
6672
createAndOpenFile();
6773
}
6874

0 commit comments

Comments
 (0)