20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 test |
25 @test |
|
26 @key headful |
26 @bug 4870762 |
27 @bug 4870762 |
27 @summary tests that a drop target JVM doesn't crash if the source doesn't export |
28 @summary tests that a drop target JVM doesn't crash if the source doesn't export |
28 data in native formats. |
29 data in native formats. |
29 @author das@sparc.spb.su area=dnd |
30 @run main NoFormatsCrashTest main |
30 @compile NoFormatsCrashTest.java |
|
31 @run applet NoFormatsCrashTest.html |
|
32 */ |
31 */ |
33 |
32 |
34 // Note there is no @ in front of test above. This is so that the |
|
35 // harness will not mistake this file as a test file. It should |
|
36 // only see the html file as a test file. (the harness runs all |
|
37 // valid test files, so it would run this test twice if this file |
|
38 // were valid as well as the html file.) |
|
39 // Also, note the area= after Your Name in the author tag. Here, you |
|
40 // should put which functional area the test falls in. See the |
|
41 // AWT-core home page -> test areas and/or -> AWT team for a list of |
|
42 // areas. |
|
43 // Note also the 'NoFormatsCrashTest.html' in the run tag. This should |
|
44 // be changed to the name of the test. |
|
45 |
|
46 |
|
47 /** |
|
48 * NoFormatsCrashTest.java |
|
49 * |
|
50 * summary: tests that a drop target JVM doesn't crash if the source doesn't export |
|
51 * data in native formats. |
|
52 */ |
|
53 |
|
54 import java.applet.Applet; |
|
55 import java.awt.*; |
33 import java.awt.*; |
56 import java.awt.datatransfer.*; |
34 import java.awt.datatransfer.*; |
57 import java.awt.dnd.*; |
35 import java.awt.dnd.*; |
58 import java.awt.event.*; |
36 import java.awt.event.*; |
59 import java.io.*; |
37 import java.io.*; |
60 |
38 |
61 |
39 public class NoFormatsCrashTest { |
62 //Automated tests should run as applet tests if possible because they |
|
63 // get their environments cleaned up, including AWT threads, any |
|
64 // test created threads, and any system resources used by the test |
|
65 // such as file descriptors. (This is normally not a problem as |
|
66 // main tests usually run in a separate VM, however on some platforms |
|
67 // such as the Mac, separate VMs are not possible and non-applet |
|
68 // tests will cause problems). Also, you don't have to worry about |
|
69 // synchronisation stuff in Applet tests they way you do in main |
|
70 // tests... |
|
71 |
|
72 |
|
73 public class NoFormatsCrashTest extends Applet { |
|
74 |
40 |
75 final Frame frame = new Frame(); |
41 final Frame frame = new Frame(); |
76 private volatile Process process; |
42 private volatile Process process; |
77 |
43 |
78 static final int FRAME_ACTIVATION_TIMEOUT = 2000; |
44 static final int FRAME_ACTIVATION_TIMEOUT = 2000; |
79 |
45 |
80 public static void main(String[] args) { |
46 public static void main(String[] args) { |
|
47 if (args.length > 0 && args[0].equals("main")) { |
|
48 NoFormatsCrashTest test = new NoFormatsCrashTest(); |
|
49 test.init(); |
|
50 test.start(); |
|
51 return; |
|
52 } |
|
53 |
81 NoFormatsCrashTest test = new NoFormatsCrashTest(); |
54 NoFormatsCrashTest test = new NoFormatsCrashTest(); |
82 test.run(args); |
55 test.run(args); |
83 } |
56 } |
84 |
57 |
85 public void run(String[] args) { |
58 public void run(String[] args) { |