< prev index next >

test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -21,13 +21,13 @@
  * questions.
  */
 
 /*
   @test
-  @bug 8037776
+  @key headful
+  @bug 8037776 8167288
   @summary tests that the WarningWindow is properly disposed
-  @author Petr Pchelko
   @library ../../regtesthelpers/process
   @build ProcessResults ProcessCommunicator
   @run main WarningWindowDisposeTest
 */
 

@@ -43,17 +43,21 @@
 public class WarningWindowDisposeTest {
 
     public static void main(String[] args) {
         final AtomicBoolean passed = new AtomicBoolean(false);
         new Thread(() -> {
+            for (int trial = 0; trial < 5; ++trial) {
             try {
-                Thread.sleep(5000);
+                    Thread.sleep(2000);
             } catch (InterruptedException e) {
                 throw new RuntimeException("Test FAILED!", e);
             }
-            if (!passed.get()) {
-                throw new RuntimeException("Test FAILED! The child process never exits");
+                if (passed.get()) {
+                    break;
+                } else if (trial == 4) {
+                    throw new RuntimeException("Child process never exits");
+                }
             }
         }, "TimeoutThread").start();
 
         String classpath = System.getProperty("java.class.path");
         String policyPath = System.getProperty("test.src")+File.separatorChar+"policy";
< prev index next >