--- old/src/java.desktop/share/classes/java/awt/Robot.java 2014-09-26 18:14:09.345166699 +0400 +++ new/src/java.desktop/share/classes/java/awt/Robot.java 2014-09-26 18:14:08.989221406 +0400 @@ -34,9 +34,12 @@ import java.awt.image.WritableRaster; import java.awt.peer.RobotPeer; import java.lang.reflect.InvocationTargetException; +import java.security.AccessController; + import sun.awt.AWTPermissions; import sun.awt.ComponentFactory; import sun.awt.SunToolkit; +import sun.awt.OSInfo; import sun.awt.image.SunWritableRaster; /** @@ -550,27 +553,17 @@ } /** - * Waits until all events currently on the event queue have been processed. + * Waits until all events currently on the event queue have been processed and tries + * to synchronize with the native windowing sub-system. * @throws IllegalThreadStateException if called on the AWT event dispatching thread */ public synchronized void waitForIdle() { checkNotDispatchThread(); - // post a dummy event to the queue so we know when - // all the events before it have been processed - try { - SunToolkit.flushPendingEvents(); - EventQueue.invokeAndWait( new Runnable() { - public void run() { - // dummy implementation - } - } ); - } catch(InterruptedException ite) { - System.err.println("Robot.waitForIdle, non-fatal exception caught:"); - ite.printStackTrace(); - } catch(InvocationTargetException ine) { - System.err.println("Robot.waitForIdle, non-fatal exception caught:"); - ine.printStackTrace(); - } + SunToolkit.flushPendingEvents(); + + // 7185258: realSync() call blocks all DnD tests on OS X + if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) != OSInfo.OSType.MACOSX) + ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); } private void checkNotDispatchThread() { --- old/test/lib/testlibrary/ExtendedRobot.java 2014-09-26 18:14:10.549981522 +0400 +++ new/test/lib/testlibrary/ExtendedRobot.java 2014-09-26 18:14:10.153042530 +0400 @@ -23,9 +23,6 @@ * questions. */ -import sun.awt.ExtendedKeyCodes; -import sun.awt.SunToolkit; - import java.awt.AWTException; import java.awt.Robot; import java.awt.GraphicsDevice; @@ -33,6 +30,7 @@ import java.awt.Point; import java.awt.MouseInfo; import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; /** * ExtendedRobot is a subclass of {@link java.awt.Robot}. It provides some convenience methods that are @@ -178,8 +176,7 @@ * dispatching thread */ public synchronized void waitForIdle(int delayValue) { - SunToolkit.flushPendingEvents(); - ((SunToolkit) Toolkit.getDefaultToolkit()).realSync(); + super.waitForIdle(); delay(delayValue); } @@ -382,7 +379,7 @@ * @see java.awt.event.KeyEvent */ public void type(char c) { - type(ExtendedKeyCodes.getExtendedKeyCodeForChar(c)); + type(KeyEvent.getExtendedKeyCodeForChar(c)); } /**