Mercurial > hg > release > icedtea-web-1.7
changeset 532:ede3d73b7e24
Add automatic closing to AppletTakesLastParam browser test
author | Adam Domurad <adomurad@redhat.com> |
---|---|
date | Tue, 16 Oct 2012 16:55:52 -0400 |
parents | c4dc3da913ab |
children | 6e622e87010e |
files | ChangeLog tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java |
diffstat | 3 files changed, 30 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Oct 15 10:36:56 2012 +0200 +++ b/ChangeLog Tue Oct 16 16:55:52 2012 -0400 @@ -1,3 +1,10 @@ +2012-10-16 Adam Domurad <adomurad@redhat.com> + + * tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java: + Add 'standard' applet closing message. + * tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java: + Clean-up code and add automatic applet closing on finish. + 2012-10-15 Jana Fabrikova <jfabriko@redhat.com> * tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java:
--- a/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java Mon Oct 15 10:36:56 2012 +0200 +++ b/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java Tue Oct 16 16:55:52 2012 -0400 @@ -38,26 +38,11 @@ exception statement from your version. */ public class AppletTakesLastParam extends Applet { - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Applet killing itself after " + n + " ms"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer = new Killer(); - - @Override public void init() { System.out.println(getParameter("param")); - killer.start(); + System.out.println("*** APPLET FINISHED ***"); + + // Exits JNLP-launched applets, throws exception on normal applet: + System.exit(0); } }
--- a/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java Mon Oct 15 10:36:56 2012 +0200 +++ b/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java Tue Oct 16 16:55:52 2012 -0400 @@ -1,4 +1,4 @@ -/* AppletTestTests.java +/* AppletTakesLastParamTests.java Copyright (C) 2011 Red Hat, Inc. This file is part of IcedTea. @@ -35,8 +35,8 @@ exception statement from your version. */ -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.ProcessResult; +import net.sourceforge.jnlp.ServerAccess.AutoClose; import net.sourceforge.jnlp.browsertesting.BrowserTest; import net.sourceforge.jnlp.browsertesting.Browsers; import net.sourceforge.jnlp.annotations.TestInBrowsers; @@ -45,24 +45,25 @@ import org.junit.Test; public class AppletTakesLastParamTests extends BrowserTest { + private void evaluate(ProcessResult pr) { + String firstParam = "value1"; + String secondParam = "value2"; - @Test - public void AppletTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavaws(null, "/appletTakesLastParam.jnlp"); - evaluateApplet(pr); - } - - private void evaluateApplet(ProcessResult pr) { - String s0 = "value1"; - Assert.assertTrue("AppletTakesLastParam stdout should not contain " + s0 + " but did.", !pr.stdout.contains(s0)); - String s1 = "value2"; - Assert.assertTrue("AppletTakesLastParam stdout should contain " + s1 + " but did not.", pr.stdout.contains(s1)); + Assert.assertFalse("AppletTakesLastParam stdout should not contain " + firstParam + " but did.", + pr.stdout.contains(firstParam)); + Assert.assertTrue("AppletTakesLastParam stdout should contain " + secondParam + " but did not.", + pr.stdout.contains(secondParam)); } @Test @TestInBrowsers(testIn = {Browsers.one}) - public void AppletInFirefoxTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html"); - evaluateApplet(pr); + public void appletTakesLastParam() throws Exception { + ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html", AutoClose.CLOSE_ON_BOTH); + evaluate(pr); } -} + @Test + public void jnlpTakesLastParam() throws Exception { + ProcessResult pr = server.executeJavaws("/appletTakesLastParam.jnlp"); + evaluate(pr); + } +} \ No newline at end of file