diff options
author | Pawel Piech | 2012-05-15 22:34:16 +0000 |
---|---|---|
committer | Eugene Tarassov | 2012-05-18 17:27:13 +0000 |
commit | b9d494c47011ed245f858db821c419ad32c30b1e (patch) | |
tree | 519aa6aa4a610221dcf01b2020b6b46224af3376 | |
parent | 3b9566dda148c6b69a39bd170fd5b53de77f55b5 (diff) | |
download | org.eclipse.tcf-b9d494c47011ed245f858db821c419ad32c30b1e.tar.gz org.eclipse.tcf-b9d494c47011ed245f858db821c419ad32c30b1e.tar.xz org.eclipse.tcf-b9d494c47011ed245f858db821c419ad32c30b1e.zip |
Bug 379189 - [tests] Add test to measure stepping performance
Add timeout to viewer and source listeners.
3 files changed, 37 insertions, 5 deletions
diff --git a/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/AbstractTcfUITest.java b/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/AbstractTcfUITest.java index 7ece8b994..d09d15241 100644 --- a/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/AbstractTcfUITest.java +++ b/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/AbstractTcfUITest.java @@ -153,7 +153,7 @@ public abstract class AbstractTcfUITest extends TcfTestCase implements IViewerUp // Turn off the automatic perspective switch and debug view activation to avoid // JFace views from interfering with the virtual viewers used in tests. IPreferenceStore prefs = DebugUITools.getPreferenceStore(); - prefs.setValue(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, true); + prefs.setValue(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, false); prefs.setValue(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, MessageDialogWithToggle.NEVER); super.initialize(); diff --git a/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/SourceDisplayListener.java b/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/SourceDisplayListener.java index 2522744d3..62f0ea2a4 100644 --- a/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/SourceDisplayListener.java +++ b/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/SourceDisplayListener.java @@ -52,6 +52,10 @@ public class SourceDisplayListener implements IPartListener, IAnnotationModelLis private boolean fAnnotationFound = false; private IAnnotationModel fAnnotationModel = null; + private int fTimeoutInterval = 60000; + private long fTimeoutTime; + + public SourceDisplayListener() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); fPage = window.getActivePage(); @@ -74,6 +78,7 @@ public class SourceDisplayListener implements IPartListener, IAnnotationModelLis public void reset() { fFileFound = false; fAnnotationFound = false; + fTimeoutTime = System.currentTimeMillis() + fTimeoutInterval; } public void setCodeArea(CodeArea area) { @@ -81,7 +86,11 @@ public class SourceDisplayListener implements IPartListener, IAnnotationModelLis fExpectedLine = area.start_line; checkFile(); } - + + public boolean isTimedOut() { + return fTimeoutInterval > 0 && fTimeoutTime < System.currentTimeMillis(); + } + public void waitTillFinished() throws InterruptedException { synchronized(this) { while(!isFinished()) { @@ -91,6 +100,10 @@ public class SourceDisplayListener implements IPartListener, IAnnotationModelLis } public synchronized boolean isFinished() { + if (isTimedOut()) { + throw new RuntimeException("Timed Out: " + toString()); + } + return fFileFound && fAnnotationFound; } @@ -180,4 +193,23 @@ public class SourceDisplayListener implements IPartListener, IAnnotationModelLis return false; } + @Override + public String toString() { + StringBuffer buf = new StringBuffer("Source Display Listener"); + + buf.append("\n\t"); + buf.append("fExpectedFile = "); + buf.append( fExpectedFile ); + buf.append(" (found="); + buf.append(fFileFound); + buf.append(")"); + buf.append("\n\t"); + buf.append("fExpectedLine = "); + buf.append( fExpectedLine ); + buf.append(" (found="); + buf.append(fAnnotationFound); + buf.append(")"); + return buf.toString(); + } + } diff --git a/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/ViewerUpdatesListener.java b/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/ViewerUpdatesListener.java index be2c0ad30..0672b9d11 100644 --- a/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/ViewerUpdatesListener.java +++ b/tests/plugins/org.eclipse.tcf.debug.test/src/org/eclipse/tcf/debug/test/ViewerUpdatesListener.java @@ -259,9 +259,9 @@ public class ViewerUpdatesListener } public boolean isFinished(int flags) { -// if (isTimedOut()) { -// throw new RuntimeException("Timed Out: " + toString(flags)); -// } + if (isTimedOut()) { + throw new RuntimeException("Timed Out: " + toString(flags)); + } if (fFailOnRedundantUpdates && !fRedundantUpdates.isEmpty()) { Assert.fail("Redundant Updates: " + fRedundantUpdates.toString()); |