[OpenJDK 2D-Dev] <Swing Dev> [12] Review Request: 8213110 Remove the use of applets in automatic tests

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Feb 15 06:30:51 UTC 2019


Hi, Phil.

Thank you for review, see my comments inline:

> You discuss the life cycle of an applet in jtreg
> -----------
>    - Call init() and start() methods of the Applet
>    - Waits for 2 seconds
>    - Call stop() and destroy() methods of the Applet
>    - Dispose the frame
> ------
> 
> I see init() and start() being used but I don't see the rest replaced. Why not ?

Because most of our tests override init() and start() and skip stop()/destroy().

> Do you really mean jtreg() kills the applet just two seconds after start() returns ?

After two seconds it will call stop()/destroy() then dispose the frame and exit.
https://hg.openjdk.java.net/code-tools/jtreg/file/6f00c63c0a98/src/share/classes/com/sun/javatest/regtest/agent/AppletWrapper.java#l157

> For the tests where you do something like
>   main(...) {
> ....
> obj.init();
> obj.start();
> 
> eg here :
> http://cr.openjdk.java.net/~serb/8213110/webrev.04/test/jdk/java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest.java.sdiff.html
> would it make sense to invoke that code on the EDT instead of the main thread ?

In this awt test it is not necessary, but some other tests(for Swing library) should be updated at some point.

> EventQueue.invokeLater(new Runnable() {
> 
> Like already happens here :
> http://cr.openjdk.java.net/~serb/8213110/webrev.04/test/jdk/java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java.sdiff.html
> We have lots of AWT tests that use the main thread so not a blocker but just a question and
> likely could mean further updates to some tests are needed if an exception no longer propagates
> on an expected thread.

In this test it is needed because otherwise "fd.setVisible(true)" will block the "main()" thread.


-- 
Best regards, Sergey.


More information about the 2d-dev mailing list