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); }