mark testonly back to discourage usage

This commit is contained in:
Alexey Kudravtsev
2018-09-17 18:30:35 +03:00
parent 858e241d05
commit c60b8aab8f
4 changed files with 7 additions and 6 deletions

View File

@@ -158,7 +158,7 @@ class StoreAwareProjectManager(virtualFileManager: VirtualFileManager, progressM
}
override fun flushChangedProjectFileAlarm() {
changedFilesAlarm.flush()
changedFilesAlarm.drainRequestsInTest()
}
override fun reloadProject(project: Project) {

View File

@@ -255,7 +255,8 @@ public class Alarm implements Disposable {
return count;
}
public void flush() {
@TestOnly
public void drainRequestsInTest() {
List<Runnable> unfinishedTasks;
synchronized (LOCK) {
if (myRequests.isEmpty()) {

View File

@@ -174,18 +174,18 @@ public abstract class EditorBasedStatusBarPopup extends EditorBasedWidget implem
@TestOnly
public void updateInTests(boolean immediately) {
update();
update.flush();
update.drainRequestsInTest();
UIUtil.dispatchAllInvocationEvents();
if (immediately) {
// for widgets with background activities, the first flush() adds handlers to be called
update.flush();
update.drainRequestsInTest();
UIUtil.dispatchAllInvocationEvents();
}
}
@TestOnly
public void flushUpdateInTests() {
update.flush();
update.drainRequestsInTest();
}
public void update() {

View File

@@ -151,7 +151,7 @@ public class AlarmTest extends PlatformTestCase {
alarm.addRequest(() -> sb.append("1"), 0, ModalityState.NON_MODAL);
alarm.addRequest(() -> sb.append("2"), 5, ModalityState.NON_MODAL);
assertEquals("", sb.toString());
alarm.flush();
alarm.drainRequestsInTest();
assertEquals("12", sb.toString());
}