jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java
author goetz
Tue, 14 Jun 2016 10:44:59 +0200
changeset 39056 d99e63b6d962
parent 27763 1fba965925e8
permissions -rw-r--r--
8159690: [TESTBUG] Mark headful tests with @key headful. Reviewed-by: simonis, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24535
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     1
/*
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 27763
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
24535
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     4
 *
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     8
 *
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    13
 * accompanied this code).
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    14
 *
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    18
 *
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    21
 * questions.
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    22
 */
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    23
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    24
/*
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    25
  @test
39056
d99e63b6d962 8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents: 27763
diff changeset
    26
  @key headful
24535
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    27
  @bug 8041490
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    28
  @summary tests that the WarningWindow's surface is invalidated on dispose
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    29
  @author Petr Pchelko
27763
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    30
  @run main/othervm/policy=policy  -Djava.security.manager WarningWindowDisposeCrashTest
24535
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    31
*/
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    32
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    33
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    34
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    35
import java.awt.*;
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    36
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    37
public class WarningWindowDisposeCrashTest {
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    38
    public static void main(String[] args) throws Exception {
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    39
        Frame f = new Frame();
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    40
        f.setVisible(true);
27763
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    41
        Robot robot;
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    42
        try{
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    43
            robot = new Robot();
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    44
            robot.waitForIdle();
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    45
        }catch(Exception ex) {
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    46
            ex.printStackTrace();
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    47
            throw new RuntimeException("Cannot create Robot");
1fba965925e8 8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents: 24535
diff changeset
    48
        }
24535
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    49
        Thread.sleep(1000);
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    50
        f.dispose();
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    51
        // If the bug is present VM could crash after this call
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    52
        for (int i = 0; i < 1000; i++) Toolkit.getDefaultToolkit().sync();
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    53
    }
9b1698300d1d 8041490: PIT: [macosx] Crash in system tray functionality check test
pchelko
parents:
diff changeset
    54
}