8074092: Newly introduced unnecessary dependencies on internal API in client regtests
authoryan
Thu, 05 Mar 2015 11:07:48 +0300
changeset 29514 973914c573fc
parent 29513 643ff69483e8
child 29515 b56181e8ad3c
8074092: Newly introduced unnecessary dependencies on internal API in client regtests Reviewed-by: serb, azvegint
jdk/test/java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java
jdk/test/java/awt/Desktop/8064934/bug8064934.java
jdk/test/java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java
jdk/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java
jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java
jdk/test/javax/swing/JButton/4796987/bug4796987.java
jdk/test/javax/swing/JFileChooser/8062561/bug8062561.java
jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java
--- a/jdk/test/java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/java/awt/Choice/ItemStateChangeTest/ItemStateChangeTest.java	Thu Mar 05 11:07:48 2015 +0300
@@ -27,15 +27,17 @@
   @summary awt Choice doesn't fire ItemStateChange when selecting item after select() call
   @author Oleg Pekhovskiy: area=awt-choice
   @library ../../regtesthelpers
+  @library ../../../../lib/testlibrary
   @build Util
+  @build jdk.testlibrary.OSInfo
   @run main ItemStateChangeTest
 */
 
 import test.java.awt.regtesthelpers.Util;
+import jdk.testlibrary.OSInfo;
 
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.OSInfo;
 
 public class ItemStateChangeTest extends Frame {
 
--- a/jdk/test/java/awt/Desktop/8064934/bug8064934.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/java/awt/Desktop/8064934/bug8064934.java	Thu Mar 05 11:07:48 2015 +0300
@@ -25,10 +25,11 @@
  * @bug 8064934
  * @summary Incorrect Exception message from java.awt.Desktop.open()
  * @author Dmitry Markov
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @run main bug8064934
  */
-import sun.awt.OSInfo;
-
+import jdk.testlibrary.OSInfo;
 import java.awt.*;
 import java.io.File;
 import java.io.IOException;
--- a/jdk/test/java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/java/awt/Menu/OpensWithNoGrab/OpensWithNoGrab.java	Thu Mar 05 11:07:48 2015 +0300
@@ -27,6 +27,8 @@
   @summary REG: Menu does not disappear when clicked, keeping Choice's drop-down open, XToolkit
   @author andrei.dmitriev: area=awt.menu
   @library ../../regtesthelpers
+  @library ../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
   @build Util
   @run main OpensWithNoGrab
 */
@@ -34,7 +36,7 @@
 import java.awt.*;
 import java.awt.event.*;
 
-import sun.awt.OSInfo;
+import jdk.testlibrary.OSInfo;
 import test.java.awt.regtesthelpers.Util;
 
 public class OpensWithNoGrab
--- a/jdk/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java	Thu Mar 05 11:07:48 2015 +0300
@@ -21,8 +21,7 @@
 * questions.
 */
 
-import sun.awt.OSInfo;
-
+import jdk.testlibrary.OSInfo;
 import java.awt.*;
 import java.awt.Robot;
 import java.awt.event.InputEvent;
@@ -38,6 +37,8 @@
  * @bug 8024185
  * @summary Native Mac OS X full screen does not work after showing the splash
  * @library ../
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @build GenerateTestImage
  * @run main GenerateTestImage
  * @author Petr Pchelko area=awt.event
--- a/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/java/awt/event/KeyEvent/SwallowKeyEvents/SwallowKeyEvents.java	Thu Mar 05 11:07:48 2015 +0300
@@ -27,10 +27,13 @@
   @summary   Tests that key events with modifiers are not swallowed.
   @author    anton.tarasov: area=awt.focus
   @library   ../../../regtesthelpers
+  @library ../../../../../lib/testlibrary
+  @build jdk.testlibrary.OSInfo
   @build     Util
   @run       main SwallowKeyEvents
 */
 
+import jdk.testlibrary.OSInfo;
 import java.awt.AWTException;
 import java.awt.Frame;
 import java.awt.Robot;
@@ -49,7 +52,7 @@
     static Robot r;
 
     public static void main(String[] args) {
-        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.WINDOWS) {
+        if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
             System.out.println("Skipped. Test not for MS Windows.");
             return;
         }
--- a/jdk/test/javax/swing/JButton/4796987/bug4796987.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/javax/swing/JButton/4796987/bug4796987.java	Thu Mar 05 11:07:48 2015 +0300
@@ -27,14 +27,15 @@
  * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F
  * @author Alexander Scherbatiy
  * @library ../../regtesthelpers
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @build Util
  * @run main bug4796987
  */
 
+import jdk.testlibrary.OSInfo;
 import java.awt.*;
 import javax.swing.*;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
 import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
 
 public class bug4796987 {
@@ -51,7 +52,6 @@
     }
 
     private static void testButtonBorder() throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         Robot robot = new Robot();
         robot.setAutoDelay(50);
 
@@ -62,7 +62,7 @@
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         Thread.sleep(500);
 
         Point p1 = Util.getCenterPoint(button1);
--- a/jdk/test/javax/swing/JFileChooser/8062561/bug8062561.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/javax/swing/JFileChooser/8062561/bug8062561.java	Thu Mar 05 11:07:48 2015 +0300
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import jdk.testlibrary.OSInfo;
 import java.awt.Robot;
 import java.awt.event.KeyEvent;
 import java.io.File;
@@ -31,12 +32,13 @@
 import javax.swing.JFileChooser;
 import javax.swing.SwingUtilities;
 import javax.swing.filechooser.FileSystemView;
-import sun.awt.OSInfo;
 
 /**
  * @test
  * @bug 8062561
  * @summary File system view returns null default directory
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @run main/othervm bug8062561 GENERATE_POLICY
  * @run main/othervm/policy=security.policy bug8062561 CHECK_DEFAULT_DIR run
  */
@@ -72,7 +74,7 @@
         File defaultDirectory = FileSystemView.getFileSystemView().
                 getDefaultDirectory();
         if (defaultDirectory != null) {
-            throw new RuntimeException("File system default directory is null!");
+            throw new RuntimeException("File system default directory must be null! (FilePermission has not been granted in our policy file).");
         }
     }
     private static volatile JFileChooser fileChooser;
--- a/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java	Wed Mar 04 15:42:02 2015 +0100
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java	Thu Mar 05 11:07:48 2015 +0300
@@ -27,9 +27,12 @@
  * @summary Tests duplicate mnemonics
  * @author Peter Zhelezniakov
  * @library ../../regtesthelpers
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @build Util
  * @run main bug6827786
  */
+import jdk.testlibrary.OSInfo;
 import java.awt.*;
 import java.awt.event.KeyEvent;
 import javax.swing.*;
@@ -63,7 +66,7 @@
         checkfocus();
 
         // select menu
-        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+        if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
             Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_F);
         } else {
             Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_F);