/hg/icedtea-web: Add automatic closing to AppletBaseURL tests
adomurad at icedtea.classpath.org
adomurad at icedtea.classpath.org
Tue Oct 16 14:16:21 PDT 2012
changeset 6e622e87010e in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=6e622e87010e
author: Adam Domurad <adomurad at redhat.com>
date: Tue Oct 16 17:18:52 2012 -0400
Add automatic closing to AppletBaseURL tests
diffstat:
tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java | 23 +--------
tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java | 21 ++++----
2 files changed, 15 insertions(+), 29 deletions(-)
diffs (93 lines):
diff -r ede3d73b7e24 -r 6e622e87010e tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java
--- a/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java Tue Oct 16 16:55:52 2012 -0400
+++ b/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java Tue Oct 16 17:18:52 2012 -0400
@@ -37,28 +37,13 @@
import java.applet.Applet;
public class AppletBaseURL extends Applet {
-
- private class Killer extends Thread {
-
- public int n = 1000;
-
- @Override
- public void run() {
- try {
- Thread.sleep(n);
- System.out.println("Aplet killing himself after " + n + " ms of life");
- System.exit(0);
- } catch (Exception ex) {
- }
- }
- }
- private Killer killer;
-
@Override
public void init() {
System.out.println("Document base is " + getDocumentBase() + " for this applet");
System.out.println("Codebase is " + getCodeBase() + " for this applet");
- killer = new Killer();
- killer.start();
+ System.out.println("*** APPLET FINISHED ***");
+
+ // Exits JNLP-launched applets, throws exception on normal applet:
+ System.exit(0);
}
}
diff -r ede3d73b7e24 -r 6e622e87010e tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java
--- a/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java Tue Oct 16 16:55:52 2012 -0400
+++ b/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java Tue Oct 16 17:18:52 2012 -0400
@@ -35,7 +35,8 @@
exception statement from your version.
*/
-import net.sourceforge.jnlp.ServerAccess.ProcessResult;
+import net.sourceforge.jnlp.ProcessResult;
+import net.sourceforge.jnlp.ServerAccess.AutoClose;
import net.sourceforge.jnlp.annotations.Bug;
import net.sourceforge.jnlp.annotations.NeedsDisplay;
import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -48,18 +49,18 @@
public class AppletBaseURLTest extends BrowserTest{
private void evaluateApplet(ProcessResult pr, String baseName) {
- String s8 = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*";
- Assert.assertTrue("AppletBaseURL stdout should match" + s8 + " but didn't", pr.stdout.matches(s8));
- String s9 = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*";
- Assert.assertTrue("AppletBaseURL stdout should match" + s9 + " but didn't", pr.stdout.matches(s9));
- String ss = "xception";
- Assert.assertFalse("AppletBaseURL stderr should not contain" + ss + " but did", pr.stderr.contains(ss));
+ String codebaseRule = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*";
+ Assert.assertTrue("AppletBaseURL stdout should match" + codebaseRule + " but didn't",
+ pr.stdout.matches(codebaseRule));
+ String documentbaseRule = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*";
+ Assert.assertTrue("AppletBaseURL stdout should match" + documentbaseRule + " but didn't",
+ pr.stdout.matches(documentbaseRule));
}
@NeedsDisplay
@Test
public void AppletWebstartBaseURLTest() throws Exception {
- ProcessResult pr = server.executeJavaws(null, "/AppletBaseURLTest.jnlp");
+ ProcessResult pr = server.executeJavaws("/AppletBaseURLTest.jnlp");
evaluateApplet(pr, "");
Assert.assertFalse(pr.wasTerminated);
Assert.assertEquals((Integer) 0, pr.returnValue);
@@ -70,7 +71,7 @@
@Test
@TestInBrowsers(testIn={Browsers.one})
public void AppletInFirefoxTest() throws Exception {
- ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html");
+ ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html", AutoClose.CLOSE_ON_BOTH);
pr.process.destroy();
evaluateApplet(pr, "AppletBaseURLTest.html");
Assert.assertTrue(pr.wasTerminated);
@@ -81,7 +82,7 @@
@Test
@TestInBrowsers(testIn={Browsers.one})
public void AppletWithJNLPHrefTest() throws Exception {
- ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html");
+ ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html", AutoClose.CLOSE_ON_BOTH);
pr.process.destroy();
evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html");
Assert.assertTrue(pr.wasTerminated);
More information about the distro-pkg-dev
mailing list