blob: df50a745c4757657a87eca848111e3216561f724 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.tests.performance;
import org.eclipse.test.performance.Dimension;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
/**
* Performance tests for showing views.
* There are separate tests for showing a simple view (MockViewPart)
* and a more complex view (Resource Navigator).
* The views are shown in an empty perspective.
*/
public class OpenCloseViewTest extends BasicPerformanceTest {
private String viewId;
public OpenCloseViewTest(String viewId, int tagging) {
super("showView:" + viewId, tagging);
this.viewId = viewId;
}
protected void runTest() throws Throwable {
IWorkbenchWindow window = openTestWindow();
final IWorkbenchPage page = window.getActivePage();
// prime it
IViewPart view1 = page.showView(viewId);
page.hideView(view1);
waitForBackgroundJobs();
processEvents();
tagIfNecessary("UI - Open/Close " + view1.getTitle(), Dimension.ELAPSED_PROCESS);
setDegradationComment("<a href=https://bugs.eclipse.org/bugs/show_bug.cgi?id=98144>See Bug 98144</a> ");
exercise(new TestRunnable() {
public void run() throws Exception {
startMeasuring();
IViewPart view = page.showView(viewId);
processEvents();
page.hideView(view);
processEvents();
stopMeasuring();
}
});
commitMeasurements();
assertPerformance();
}
}