jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java
changeset 27763 1fba965925e8
parent 24535 9b1698300d1d
child 39056 d99e63b6d962
--- a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java	Sun Nov 09 22:17:45 2014 +0300
+++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java	Mon Nov 10 16:23:30 2014 +0300
@@ -26,26 +26,25 @@
   @bug 8041490
   @summary tests that the WarningWindow's surface is invalidated on dispose
   @author Petr Pchelko
-  @run main/othervm WarningWindowDisposeCrashTest
+  @run main/othervm/policy=policy  -Djava.security.manager WarningWindowDisposeCrashTest
 */
 
 
-import sun.applet.AppletSecurity;
-import sun.awt.SunToolkit;
 
 import java.awt.*;
 
 public class WarningWindowDisposeCrashTest {
     public static void main(String[] args) throws Exception {
-        System.setSecurityManager(new AppletSecurity() {
-            @Override
-            public void checkPackageAccess (String s){
-            }
-        });
-
         Frame f = new Frame();
         f.setVisible(true);
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Robot robot;
+        try{
+            robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Cannot create Robot");
+        }
         Thread.sleep(1000);
         f.dispose();
         // If the bug is present VM could crash after this call