From 3e57c61729c8ec5ca4600ebceccf8a5714bdc21a Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 2 Mar 2017 09:32:14 +0100 Subject: [PATCH] ConsoleViewImplTest.testPerformance: dispatch events without reflection and unnecessary checks --- .../com/intellij/execution/impl/ConsoleViewImplTest.java | 2 +- .../src/com/intellij/testFramework/PlatformTestUtil.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java b/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java index 588ba317a696..8ba659972832 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/impl/ConsoleViewImplTest.java @@ -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(); diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 796fe6d2ed8c..9ae8e0bbc69c 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -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); }