ConsoleViewImplTest.testPerformance: dispatch events without reflection and unnecessary checks

This commit is contained in:
peter
2017-03-02 09:32:51 +01:00
parent 53b19ebeae
commit 3e57c61729
2 changed files with 3 additions and 5 deletions
@@ -228,7 +228,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
for (int i=0; i<10_000_000; i++) {
console.print("xxx\n", ConsoleViewContentType.NORMAL_OUTPUT);
console.print("yyy\n", ConsoleViewContentType.SYSTEM_OUTPUT);
UIUtil.dispatchAllInvocationEvents();
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue();
}
LightPlatformCodeInsightTestCase.type('\n', console.getEditor(), getProject());
console.waitAllRequests();
@@ -304,8 +304,7 @@ public class PlatformTestUtil {
@TestOnly
public static void dispatchAllInvocationEventsInIdeEventQueue() throws InterruptedException {
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
final IdeEventQueue eventQueue = (IdeEventQueue)Toolkit.getDefaultToolkit().getSystemEventQueue();
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
while (true) {
AWTEvent event = eventQueue.peekEvent();
if (event == null) break;
@@ -318,8 +317,7 @@ public class PlatformTestUtil {
@TestOnly
public static void dispatchAllEventsInIdeEventQueue() throws InterruptedException {
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
final IdeEventQueue eventQueue = (IdeEventQueue)Toolkit.getDefaultToolkit().getSystemEventQueue();
IdeEventQueue eventQueue = IdeEventQueue.getInstance();
//noinspection StatementWithEmptyBody
while (dispatchNextEventIfAny(eventQueue) != null);
}