/hg/icedtea-web: Add automatic closing to AppletTakesLastParam b...

adomurad at icedtea.classpath.org adomurad at icedtea.classpath.org
Tue Oct 16 13:53:19 PDT 2012


changeset ede3d73b7e24 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=ede3d73b7e24
author: Adam Domurad <adomurad at redhat.com>
date: Tue Oct 16 16:55:52 2012 -0400

	Add automatic closing to AppletTakesLastParam browser test


diffstat:

 ChangeLog                                                                              |   7 +
 tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java           |  23 +-----
 tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java |  37 +++++----
 3 files changed, 30 insertions(+), 37 deletions(-)

diffs (110 lines):

diff -r c4dc3da913ab -r ede3d73b7e24 ChangeLog
--- 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 at 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 at redhat.com>
 
 	* tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java:
diff -r c4dc3da913ab -r ede3d73b7e24 tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.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);
     }
 }
diff -r c4dc3da913ab -r ede3d73b7e24 tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java
--- 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



More information about the distro-pkg-dev mailing list