8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
authoravstepan
Tue, 18 Nov 2014 17:10:34 +0400
changeset 28068 e0916ce5b3fc
parent 28067 447be91cbc44
child 28069 907a72cb0feb
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8 Summary: Some new tests to check FileDialog modality behavior Reviewed-by: alexsch, pchelko
jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDWDTest.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogFWDTest.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogModalityTest.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java
jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal1Test
+ */
+
+public class FileDialogAppModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal2Test
+ */
+
+public class FileDialogAppModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal3Test
+ */
+
+public class FileDialogAppModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal4Test
+ */
+
+public class FileDialogAppModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal5Test
+ */
+
+public class FileDialogAppModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.APPLICATION_MODAL,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks an application modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogAppModal6Test
+ */
+
+public class FileDialogAppModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(Dialog.ModalityType.APPLICATION_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDWDTest.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+
+
+// DWD: Dialog, Window, Dialog
+
+public class FileDialogDWDTest {
+
+    private volatile FileDialog fileDialog;
+    private volatile ParentDialog parent;
+    private volatile CustomDialog dialog;
+    private volatile TestWindow window;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    boolean setModal;
+
+    Dialog.ModalityType modalityType;
+
+    private FileDialogDWDTest(Dialog.ModalityType modType,
+                              boolean             modal) throws Exception {
+        modalityType = modType;
+        setModal = modal;
+
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::createGUI);
+    }
+
+    public FileDialogDWDTest(Dialog.ModalityType modalityType) throws Exception {
+        this(modalityType, false);
+    }
+
+    public FileDialogDWDTest() throws Exception {
+        this(null, true);
+    }
+
+    private void createGUI() {
+
+        parent = new ParentDialog();
+        dialog = new CustomDialog(parent);
+
+        if (setModal) {
+            dialog.setModal(true);
+            modalityType = dialog.getModalityType();
+        } else if (modalityType != null) {
+            dialog.setModalityType(modalityType);
+        }
+
+        window = new CustomWindow(parent);
+
+        int x = Toolkit.getDefaultToolkit().getScreenSize().width -
+            parent.getWidth() - 50;
+        int y = 50;
+        parent.setLocation(x, y);
+        y += (parent.getHeight() + 50);
+        window.setLocation(x, y);
+        y += (window.getHeight() + 50);
+        dialog.setLocation(x, y);
+
+        parent.setVisible(true);
+    }
+
+    private void openAll() throws Exception {
+        robot.waitForIdle(delay);
+        parent.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkBlockedWindows() throws Exception {
+
+        String msg = "FileDialog should block this ";
+        parent.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+    }
+
+    private void checkUnblockedWindows() throws Exception {
+
+        String msg = "Blocking dialogs were closed.";
+        parent.checkUnblockedDialog(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+    }
+
+
+    private void modalTest(String type) throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        String msg = "FileDialog was closed, " +
+            "but the " + type + " modal dialog should block this ";
+
+        parent.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        dialog.clickCloseButton(robot);
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    private void nonModalTest() throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+
+            openAll();
+
+            if (modalityType == null) {
+                nonModalTest();
+                return;
+            }
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                    modalTest("application");
+                    break;
+                case DOCUMENT_MODAL:
+                    modalTest("document");
+                    break;
+                case TOOLKIT_MODAL:
+                    modalTest("toolkit");
+                    break;
+                case MODELESS:
+                    nonModalTest();
+                    break;
+            }
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (parent != null) { parent.dispose(); }
+        if (dialog != null) { dialog.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) { fileDialog.dispose(); }
+
+    }
+
+    class ParentDialog extends TestDialog {
+
+        public ParentDialog() { super((Frame) null); }
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) { window.setVisible(true); }
+        }
+
+    }
+
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog d) { super(d); }
+
+        @Override
+        public void doOpenAction() {
+            fileDialog = new FileDialog((Frame) null);
+            fileDialog.setLocation(50, 50);
+            fileDialog.setVisible(true);
+        }
+
+        @Override
+        public void doCloseAction() {
+            this.dispose();
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(Dialog d) { super(d); }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) { dialog.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal1Test
+ */
+
+public class FileDialogDocModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal2Test
+ */
+
+public class FileDialogDocModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal3Test
+ */
+
+public class FileDialogDocModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal4Test
+ */
+
+public class FileDialogDocModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal5Test
+ */
+
+public class FileDialogDocModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.DOCUMENT_MODAL,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a document modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal6Test
+ */
+
+public class FileDialogDocModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ * @summary Check whether a FileDialog set to document modality behaves as expected.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogDocModal7Test
+ */
+
+public class FileDialogDocModal7Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogFWDTest.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+
+
+// FWD: Frame, Window, Dialog
+
+public class FileDialogFWDTest {
+
+    private volatile FileDialog fileDialog;
+    private volatile CustomDialog dialog;
+    private volatile TestFrame frame;
+    private volatile TestWindow window;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    private volatile Dialog hiddenDialog;
+    private volatile Frame  hiddenFrame;
+
+    public enum DialogOwner {
+        HIDDEN_DIALOG, NULL_DIALOG, HIDDEN_FRAME, NULL_FRAME, FRAME};
+
+    private DialogOwner owner;
+    boolean setModal;
+
+    Dialog.ModalityType modalityType;
+
+    private FileDialogFWDTest(Dialog.ModalityType modType,
+                              boolean             modal,
+                              DialogOwner         o) throws Exception {
+        modalityType = modType;
+        setModal = modal;
+        owner = o;
+
+        robot = new ExtendedRobot();
+        EventQueue.invokeLater(this::createGUI);
+    }
+
+    public FileDialogFWDTest(Dialog.ModalityType modalityType,
+                             DialogOwner         o) throws Exception {
+        this(modalityType, false, o);
+    }
+
+    public FileDialogFWDTest(DialogOwner o) throws Exception {
+        this(null, true, o);
+    }
+
+    private void createGUI() {
+
+        frame = new CustomFrame();
+
+        switch (owner) {
+            case HIDDEN_DIALOG:
+                hiddenDialog = new Dialog((Frame) null);
+                dialog = new CustomDialog(hiddenDialog);
+                break;
+            case NULL_DIALOG:
+                dialog = new CustomDialog((Dialog) null);
+                break;
+            case HIDDEN_FRAME:
+                hiddenFrame = new Frame();
+                dialog = new CustomDialog(hiddenFrame);
+                break;
+            case NULL_FRAME:
+                dialog = new CustomDialog((Frame) null);
+                break;
+            case FRAME:
+                dialog = new CustomDialog(frame);
+                break;
+        }
+
+        if (setModal) {
+            dialog.setModal(true);
+            modalityType = dialog.getModalityType();
+        } else if (modalityType != null) {
+            dialog.setModalityType(modalityType);
+        }
+
+        window = new CustomWindow(frame);
+
+        int x = Toolkit.getDefaultToolkit().getScreenSize().width -
+            frame.getWidth() - 50;
+        int y = 50;
+        frame.setLocation(x, y);
+        y += (frame.getHeight() + 50);
+        window.setLocation(x, y);
+        y += (window.getHeight() + 50);
+        dialog.setLocation(x, y);
+
+        frame.setVisible(true);
+    }
+
+    private void openAll() throws Exception {
+        robot.waitForIdle(delay);
+        frame.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkBlockedWindows() throws Exception {
+
+        String msg = "FileDialog should block this ";
+        frame.checkBlockedFrame(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, msg + "Dialog.");
+        robot.waitForIdle(delay);
+    }
+
+    private void checkUnblockedWindows() throws Exception {
+
+        String msg = "Blocking dialogs were closed.";
+        frame.checkUnblockedFrame(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+    }
+
+    private void modalTest(String type) throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        String msg = "FileDialog was closed, " +
+            "but the " + type + " modal dialog should block this ";
+
+        frame.checkBlockedFrame(robot, msg + "Frame.");
+        robot.waitForIdle(delay);
+
+        window.checkBlockedWindow(robot, msg + "Window.");
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        dialog.clickCloseButton(robot);
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    private void docModalTest() throws Exception {
+
+        if (owner == DialogOwner.FRAME) {
+
+            checkBlockedWindows();
+
+            EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+            robot.waitForIdle(delay);
+
+            String msg = "FileDialog was closed.";
+
+            dialog.checkUnblockedDialog(robot, msg);
+            robot.waitForIdle(delay);
+
+            msg += " But the blocking document modal dialog is still open.";
+
+            frame.checkBlockedFrame(robot, msg);
+            robot.waitForIdle(delay);
+
+            window.checkBlockedWindow(robot, msg);
+            robot.waitForIdle(delay);
+
+            dialog.clickCloseButton(robot);
+            robot.waitForIdle(delay);
+
+            checkUnblockedWindows();
+
+        } else {
+            nonModalTest();
+        }
+    }
+
+    private void nonModalTest() throws Exception {
+
+        checkBlockedWindows();
+
+        EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+        robot.waitForIdle(delay);
+
+        dialog.checkUnblockedDialog(robot, "FileDialog was closed.");
+        robot.waitForIdle(delay);
+
+        checkUnblockedWindows();
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            openAll();
+
+            if (modalityType == null) {
+                nonModalTest();
+                return;
+            }
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                    modalTest("application");
+                    break;
+                case DOCUMENT_MODAL:
+                    docModalTest();
+                    break;
+                case TOOLKIT_MODAL:
+                    modalTest("toolkit");
+                    break;
+                case MODELESS:
+                    nonModalTest();
+                    break;
+            }
+
+        } finally {
+            EventQueue.invokeAndWait(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (dialog != null) { dialog.dispose(); }
+        if (frame  != null) {  frame.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) { fileDialog.dispose(); }
+        if (hiddenDialog != null) { hiddenDialog.dispose(); }
+        if (hiddenFrame  != null) {  hiddenFrame.dispose(); }
+    }
+
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Dialog d) { super(d); }
+        public CustomDialog(Frame  f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            fileDialog = new FileDialog((Frame) null);
+            fileDialog.setLocation(50, 50);
+            fileDialog.setVisible(true);
+        }
+
+        @Override
+        public void doCloseAction() {
+            this.dispose();
+        }
+    }
+
+    class CustomFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) { window.setVisible(true); }
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(Frame f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) { dialog.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal1Test
+ */
+
+public class FileDialogModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal2Test
+ */
+
+public class FileDialogModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal3Test
+ */
+
+public class FileDialogModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal4Test
+ */
+
+public class FileDialogModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal5Test
+ */
+
+public class FileDialogModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogModal6Test
+ */
+
+public class FileDialogModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest()).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogModalityTest.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+public class FileDialogModalityTest {
+
+    private volatile TestDialog  dialog;
+    private volatile ParentFrame parent;
+    private volatile TestWindow  window;
+    private volatile FileDialog  fileDialog;
+
+    private static final int delay = 500;
+    private final ExtendedRobot robot;
+
+    private final Dialog.ModalityType modalityType;
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest();
+        (new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+        (new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest();
+    }
+
+    public FileDialogModalityTest(Dialog.ModalityType t) throws Exception {
+        modalityType = t;
+        robot = new ExtendedRobot();
+    }
+
+    private void createGUI() {
+
+        parent = new ParentFrame();
+        dialog = new CustomDialog((Frame) null);
+        window = new CustomWindow(parent);
+
+        int x = Toolkit.getDefaultToolkit().getScreenSize().width -
+            parent.getWidth() - 50;
+        int y = 50;
+
+        parent.setLocation(x, y);
+        y += (parent.getHeight() + 50);
+        window.setLocation(x, y);
+        y += (window.getHeight() + 50);
+        dialog.setLocation(x, y);
+
+        parent.setVisible(true);
+    }
+
+    private void startTest() throws Exception {
+
+        EventQueue.invokeLater(this::createGUI);
+
+        robot.waitForIdle(delay);
+        parent.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        window.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+        dialog.clickOpenButton(robot);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkUnblockedWindows() throws Exception {
+
+        String msg = " should not be blocked.";
+        parent.checkUnblockedFrame (robot, "This frame" + msg);
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, "This window" + msg);
+        robot.waitForIdle(delay);
+        dialog.checkUnblockedDialog(robot, "This dialog" + msg);
+        robot.waitForIdle(delay);
+    }
+
+    private void checkBlockedWindows() throws Exception {
+
+        String msg = " should be blocked by the FileDialog.";
+        parent.checkBlockedFrame (robot, "This Frame" + msg);
+        robot.waitForIdle(delay);
+        window.checkBlockedWindow(robot, "This Window" + msg);
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, "This Dialog" + msg);
+        robot.waitForIdle(delay);
+    }
+
+    private void docModalTest() throws Exception {
+
+        String msg = "Document modal FileDialog should ";
+        parent.checkUnblockedFrame (robot, msg + "not block this Frame.");
+        robot.waitForIdle(delay);
+        window.checkUnblockedWindow(robot, msg + "not block this Window.");
+        robot.waitForIdle(delay);
+        dialog.checkBlockedDialog(robot, msg + "block its parent Dialog.");
+        robot.waitForIdle(delay);
+    }
+
+    public void doTest() throws Exception {
+
+        try {
+            startTest();
+
+            switch (modalityType) {
+                case APPLICATION_MODAL:
+                case TOOLKIT_MODAL:
+                    checkBlockedWindows();
+                    break;
+                case DOCUMENT_MODAL:
+                    docModalTest();
+                    break;
+                case MODELESS:
+                    checkUnblockedWindows();
+                    break;
+            }
+
+            EventQueue.invokeAndWait(() -> { fileDialog.dispose(); });
+            robot.waitForIdle(delay);
+
+            if (modalityType != Dialog.ModalityType.MODELESS) {
+                checkUnblockedWindows();
+            }
+        } finally {
+            EventQueue.invokeLater(this::closeAll);
+        }
+    }
+
+    private void closeAll() {
+        if (parent != null) { parent.dispose(); }
+        if (dialog != null) { dialog.dispose(); }
+        if (window != null) { window.dispose(); }
+        if (fileDialog != null) { fileDialog.dispose(); }
+    }
+
+    class ParentFrame extends TestFrame {
+
+        @Override
+        public void doOpenAction() {
+            if (window != null) { window.setVisible(true); }
+        }
+    }
+
+    class CustomDialog extends TestDialog {
+
+        public CustomDialog(Frame f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            fileDialog = new FileDialog(this);
+            fileDialog.setModalityType(modalityType);
+            fileDialog.setLocation(50, 50);
+            fileDialog.setVisible(true);
+        }
+    }
+
+    class CustomWindow extends TestWindow {
+
+        public CustomWindow(TestFrame f) { super(f); }
+
+        @Override
+        public void doOpenAction() {
+            if (dialog != null) { dialog.setVisible(true); }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal1Test
+ */
+
+public class FileDialogNonModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal2Test
+ */
+
+public class FileDialogNonModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal3Test
+ */
+
+public class FileDialogNonModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal4Test
+ */
+
+public class FileDialogNonModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal5Test
+ */
+
+public class FileDialogNonModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(null,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @bug 8054359
+ *
+ * @summary Check whether FileDialog blocks a non-modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal6Test
+ */
+
+public class FileDialogNonModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(null)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359
+ * @summary Check whether a modeless FileDialog behaves as expected.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogNonModal7Test
+ */
+
+public class FileDialogNonModal7Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a null Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal1Test
+ */
+
+public class FileDialogTKModal1Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a null Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal2Test
+ */
+
+public class FileDialogTKModal2Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.NULL_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a hidden Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal3Test
+ */
+
+public class FileDialogTKModal3Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a hidden Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal4Test
+ */
+
+public class FileDialogTKModal4Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.HIDDEN_DIALOG)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a visible Frame constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal5Test
+ */
+
+public class FileDialogTKModal5Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogFWDTest(Dialog.ModalityType.TOOLKIT_MODAL,
+            FileDialogFWDTest.DialogOwner.FRAME)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 8055752
+ *
+ * @summary Check whether FileDialog blocks a toolkit modal Dialog
+ *          created with a visible Dialog constructor. Also check if other
+ *          windows are blocked by the FileDialog too.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal6Test
+ */
+
+public class FileDialogTKModal6Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogDWDTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java	Tue Nov 18 17:10:34 2014 +0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+
+/*
+ * @test
+ * @bug 8054359 7186009
+ * @summary Check whether a FileDialog set to toolkit modality behaves as expected.
+ *
+ * @library ../helpers ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @build Flag
+ * @build TestDialog
+ * @build TestFrame
+ * @build TestWindow
+ * @run main FileDialogTKModal7Test
+ */
+
+public class FileDialogTKModal7Test {
+
+    public static void main(String[] args) throws Exception {
+        (new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest();
+    }
+}