6844297: java/awt/EventQueue/6638195/bug6638195.java test failed in jdk7 on Windows just on b59,passed on b57
authorart
Fri, 17 Jul 2009 15:40:19 +0400
changeset 3334 8d5a10c419a4
parent 3237 7c6c2d9361d9
child 3335 891866221955
6844297: java/awt/EventQueue/6638195/bug6638195.java test failed in jdk7 on Windows just on b59,passed on b57 Reviewed-by: bchristi, dcherepanov
jdk/test/java/awt/EventQueue/6638195/bug6638195.java
--- a/jdk/test/java/awt/EventQueue/6638195/bug6638195.java	Tue Jul 14 14:08:47 2009 +0400
+++ b/jdk/test/java/awt/EventQueue/6638195/bug6638195.java	Fri Jul 17 15:40:19 2009 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008-2009 Sun Microsystems, Inc.  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
@@ -23,7 +23,7 @@
 
 /* @test
  *
- * @bug 6638195
+ * @bug 6638195 6844297
  * @author Igor Kushnirskiy
  * @summary tests if EventQueueDelegate.Delegate is invoked.
  */
@@ -47,11 +47,22 @@
     }
 
     private static void runTest(MyEventQueueDelegate delegate) throws Exception {
+        // We need an empty runnable here, so the next event is
+        // processed with a new EventQueueDelegate. See 6844297
+        // for details
         EventQueue.invokeLater(
             new Runnable() {
                 public void run() {
                 }
             });
+        // The following event is expected to be processed by
+        // the EventQueueDelegate instance
+        EventQueue.invokeLater(
+            new Runnable() {
+                public void run() {
+                }
+            });
+        // Finally, proceed on the main thread
         final CountDownLatch latch = new CountDownLatch(1);
         EventQueue.invokeLater(
             new Runnable() {
@@ -60,7 +71,7 @@
                 }
             });
         latch.await();
-        if (! delegate.allInvoked()) {
+        if (!delegate.allInvoked()) {
             throw new RuntimeException("failed");
         }
     }
@@ -125,6 +136,7 @@
 
         return objectMap;
     }
+
     static class MyEventQueueDelegate implements EventQueueDelegate.Delegate {
         private volatile boolean getNextEventInvoked = false;
         private volatile boolean beforeDispatchInvoked = false;