project/threads leaks in tests

This commit is contained in:
Alexey Kudravtsev
2017-03-10 20:08:52 +03:00
parent 29ca7f300d
commit 6505694e95
@@ -27,6 +27,8 @@ import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.progress.*;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerListener;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.impl.DirectoryIndexExcludePolicy;
@@ -154,6 +156,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
}
});
if (ApplicationManager.getApplication().isUnitTestMode()) {
ProjectManager.getInstance().addProjectManagerListener(project, new ProjectManagerListener() {
@Override
public void projectClosing(Project project) {
waitEverythingDoneInTestMode();
}
});
}
}
private void scheduleAutomaticChangeListDeletionIfEmpty(final LocalChangeList oldList, final VcsConfiguration config) {