/hg/icedtea-web: Added tests for html switch for Sandbox attribute

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Wed Jul 22 12:39:30 UTC 2015


changeset fff25f4c1ff6 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=fff25f4c1ff6
author: Jiri Vanek <jvanek at redhat.com>
date: Wed Jul 22 14:39:17 2015 +0200

	Added tests for html switch for Sandbox attribute

	* tests/reproducers/signed/SandboxSignedAllPerm/testcases/SandboxSignedAllPermTest.java
	* tests/reproducers/signed/SandboxSignedInvalid/testcases/SandboxSignedInvalidTest.java
	* tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTest.java
	* tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTestHighSecurity.java
	* tests/reproducers/signed/SandboxSignedSandbox/testcases/SandboxSignedSandboxTest.java
	* tests/reproducers/simple/SandboxUnsignedAllPerm/testcases/SandboxUnsignedAllPermTest.java
	* tests/reproducers/simple/SandboxUnsignedInvalid/testcases/SandboxUnsignedInvalidTest.java
	* tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTest.java
	* tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTestHighSecurity.java
	* tests/reproducers/simple/SandboxUnsignedSandbox/testcases/SandboxUnsignedSandboxTest.java


diffstat:

 ChangeLog                                                                                             |  14 ++++
 tests/reproducers/signed/SandboxSignedAllPerm/testcases/SandboxSignedAllPermTest.java                 |  10 +++
 tests/reproducers/signed/SandboxSignedInvalid/testcases/SandboxSignedInvalidTest.java                 |  10 +++
 tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTest.java                 |   9 ++
 tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTestHighSecurity.java     |  24 +++++++
 tests/reproducers/signed/SandboxSignedSandbox/testcases/SandboxSignedSandboxTest.java                 |   8 ++
 tests/reproducers/simple/SandboxUnsignedAllPerm/testcases/SandboxUnsignedAllPermTest.java             |  10 ++-
 tests/reproducers/simple/SandboxUnsignedInvalid/testcases/SandboxUnsignedInvalidTest.java             |   9 ++
 tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTest.java             |   9 ++
 tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTestHighSecurity.java |  32 ++++++++++
 tests/reproducers/simple/SandboxUnsignedSandbox/testcases/SandboxUnsignedSandboxTest.java             |   8 ++
 11 files changed, 142 insertions(+), 1 deletions(-)

diffs (316 lines):

diff -r 08f1df9b7b4b -r fff25f4c1ff6 ChangeLog
--- a/ChangeLog	Wed Jul 22 13:16:26 2015 +0200
+++ b/ChangeLog	Wed Jul 22 14:39:17 2015 +0200
@@ -1,3 +1,17 @@
+2015-07-22  Jiri Vanek  <jvanek at redhat.com>
+
+	Added tests for html switch for Sandbox attribute
+	* tests/reproducers/signed/SandboxSignedAllPerm/testcases/SandboxSignedAllPermTest.java
+	* tests/reproducers/signed/SandboxSignedInvalid/testcases/SandboxSignedInvalidTest.java
+	* tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTest.java
+	* tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTestHighSecurity.java
+	* tests/reproducers/signed/SandboxSignedSandbox/testcases/SandboxSignedSandboxTest.java
+	* tests/reproducers/simple/SandboxUnsignedAllPerm/testcases/SandboxUnsignedAllPermTest.java
+	* tests/reproducers/simple/SandboxUnsignedInvalid/testcases/SandboxUnsignedInvalidTest.java
+	* tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTest.java
+	* tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTestHighSecurity.java
+	* tests/reproducers/simple/SandboxUnsignedSandbox/testcases/SandboxUnsignedSandboxTest.java
+
 2015-07-22  Fridrich Strba  <fridrich.strba at suse.com>
 
 	* Makefile.am:  (generate-docs.stamp) added '-' to tail of tail command as
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/signed/SandboxSignedAllPerm/testcases/SandboxSignedAllPermTest.java
--- a/tests/reproducers/signed/SandboxSignedAllPerm/testcases/SandboxSignedAllPermTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/signed/SandboxSignedAllPerm/testcases/SandboxSignedAllPermTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,6 +1,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -78,6 +79,15 @@
             Assert.assertFalse(p.stdout.contains(aok.getCondition()));
             Assert.assertTrue(p.stderr.contains(aer.getCondition()));
     }
+    
+    @Test
+    public void javawsHtml() throws Exception{
+            ProcessResult p = server.executeJavaws(Arrays.asList(new String[] {OptionsDefinitions.OPTIONS.HTML.option}), "SandboxSignedAllPerm.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+            Assert.assertTrue(p.stdout.contains(confirmation));
+            Assert.assertTrue(p.stdout.contains(aok.getCondition()));
+            Assert.assertFalse(p.stderr.contains(aer.getCondition()));
+    }
+    
     @Test
     //no security dialog
     //pass
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/signed/SandboxSignedInvalid/testcases/SandboxSignedInvalidTest.java
--- a/tests/reproducers/signed/SandboxSignedInvalid/testcases/SandboxSignedInvalidTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/signed/SandboxSignedInvalid/testcases/SandboxSignedInvalidTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,5 +1,7 @@
 
 import java.io.IOException;
+import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -120,6 +122,14 @@
             Assert.assertFalse(p.stdout.contains(aok.getCondition()));
             Assert.assertTrue(p.stderr.contains(aer.getCondition()));
     }
+    
+    @Test
+    public void javawsHtml() throws Exception{
+            ProcessResult p = server.executeJavaws(Arrays.asList(new String[] {OptionsDefinitions.OPTIONS.HTML.option}), "SandboxSignedInvalid.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+            Assert.assertFalse(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 
 
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTest.java
--- a/tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,6 +1,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -125,6 +126,14 @@
             Assert.assertTrue(p.stdout.contains(aok.getCondition()));
             Assert.assertFalse(p.stderr.contains(aer.getCondition()));
     }
+    
+     @Test
+    public void javawsHtml() throws Exception{
+            ProcessResult p = server.executeJavaws(Arrays.asList(new String[] {OptionsDefinitions.OPTIONS.HTML.option}), "SandboxSignedMissing.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+            Assert.assertTrue(p.stdout.contains(confirmation));
+            Assert.assertTrue(p.stdout.contains(aok.getCondition()));
+            Assert.assertFalse(p.stderr.contains(aer.getCondition()));
+    }
 
 
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTestHighSecurity.java
--- a/tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTestHighSecurity.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/signed/SandboxSignedMissing/testcases/SandboxSignedMissingTestHighSecurity.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,6 +1,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ProcessWrapper;
 import net.sourceforge.jnlp.ServerAccess;
@@ -190,6 +191,29 @@
             Assert.assertTrue(p.stdout.contains(aok.getCondition()));
             Assert.assertFalse(p.stderr.contains(aer.getCondition()));
     }
+    
+    @Test
+    public void javawsHtmlYes() throws Exception{
+            ProcessWrapper pw = new ProcessWrapper(server.getJavawsLocation(), Arrays.asList("-headless", "-html"),  server.getUrl("SandboxSignedMissing.html"));
+            pw.addStdOutListener(new AutoOkClosingListener());
+            pw.setWriter("YES\n");
+            ProcessResult p = pw.execute();
+            Assert.assertTrue(p.stdout.contains(confirmation));
+            Assert.assertTrue(p.stdout.contains(aok.getCondition()));
+            Assert.assertFalse(p.stderr.contains(aer.getCondition()));
+    }
+    
+    @Test
+    public void javawsHtmlNo() throws Exception{
+            ProcessWrapper pw = new ProcessWrapper(server.getJavawsLocation(), Arrays.asList("-headless", "-html"),  server.getUrl("SandboxSignedMissing.html"));
+            pw.addStdOutListener(new AutoOkClosingListener());
+            pw.setWriter("NO\n");
+            ProcessResult p = pw.execute();
+            Assert.assertFalse(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
+
 
 
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/signed/SandboxSignedSandbox/testcases/SandboxSignedSandboxTest.java
--- a/tests/reproducers/signed/SandboxSignedSandbox/testcases/SandboxSignedSandboxTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/signed/SandboxSignedSandbox/testcases/SandboxSignedSandboxTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,6 +1,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -123,4 +124,11 @@
     }
 
 
+    @Test
+    public void javawsHtml() throws Exception{
+            ProcessResult p = server.executeJavaws(Arrays.asList(new String[] {OptionsDefinitions.OPTIONS.HTML.option}), "SandboxSignedSandbox.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+            Assert.assertTrue(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/simple/SandboxUnsignedAllPerm/testcases/SandboxUnsignedAllPermTest.java
--- a/tests/reproducers/simple/SandboxUnsignedAllPerm/testcases/SandboxUnsignedAllPermTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/simple/SandboxUnsignedAllPerm/testcases/SandboxUnsignedAllPermTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,10 +1,12 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
 import net.sourceforge.jnlp.browsertesting.BrowserTest;
+import static net.sourceforge.jnlp.browsertesting.BrowserTest.server;
 import net.sourceforge.jnlp.browsertesting.Browsers;
 import net.sourceforge.jnlp.closinglisteners.AutoErrorClosingListener;
 import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener;
@@ -104,7 +106,6 @@
 
     @Test
     @TestInBrowsers(testIn = Browsers.one)
-    //or this one should fail
     public void appletAllPermAllSecurity() throws Exception {
         server.getBrowserLocation();
         ProcessResult p = server.executeBrowser("SandboxUnsignedAllPerm.html", ServerAccess.AutoClose.CLOSE_ON_BOTH);
@@ -113,4 +114,11 @@
         Assert.assertTrue(p.stderr.contains(aer.getCondition()));
     }
 
+    @Test
+    public void javawsHtml() throws Exception {
+        ProcessResult p = server.executeJavaws(Arrays.asList(new String[]{OptionsDefinitions.OPTIONS.HTML.option}), "SandboxUnsignedAllPerm.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+        Assert.assertTrue(p.stdout.contains(confirmation));
+        Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+        Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/simple/SandboxUnsignedInvalid/testcases/SandboxUnsignedInvalidTest.java
--- a/tests/reproducers/simple/SandboxUnsignedInvalid/testcases/SandboxUnsignedInvalidTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/simple/SandboxUnsignedInvalid/testcases/SandboxUnsignedInvalidTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,5 +1,7 @@
 
 import java.io.IOException;
+import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -111,5 +113,12 @@
             Assert.assertTrue(p.stderr.contains(aer.getCondition()));
     }
 
+    @Test
+    public void javawsHtml() throws Exception {
+        ProcessResult p = server.executeJavaws(Arrays.asList(new String[]{OptionsDefinitions.OPTIONS.HTML.option}), "SandboxUnsignedInvalid.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+        Assert.assertFalse(p.stdout.contains(confirmation));
+        Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+        Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTest.java
--- a/tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,6 +1,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -115,6 +116,14 @@
             Assert.assertFalse(p.stdout.contains(aok.getCondition()));
             Assert.assertTrue(p.stderr.contains(aer.getCondition()));
     }
+    
+      @Test
+    public void javawsHtml() throws Exception{
+            ProcessResult p = server.executeJavaws(Arrays.asList(new String[] {OptionsDefinitions.OPTIONS.HTML.option}), "SandboxUnsignedMissing.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+            Assert.assertTrue(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 
 
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTestHighSecurity.java
--- a/tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTestHighSecurity.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/simple/SandboxUnsignedMissing/testcases/SandboxUnsignedMissingTestHighSecurity.java	Wed Jul 22 14:39:17 2015 +0200
@@ -172,6 +172,38 @@
             Assert.assertTrue(p.stdout.contains(aok.getCondition()));
             Assert.assertFalse(p.stderr.contains(aer.getCondition()));
     }
+    
+     @Test
+    public void javawsHtmlYesYes() throws Exception{
+            ProcessWrapper pw = new ProcessWrapper(server.getJavawsLocation(), Arrays.asList("-headless", "-html"),  server.getUrl("SandboxUnsignedMissing.html"));
+            pw.addStdOutListener(new AutoOkClosingListener());
+            pw.setWriter("YES\nYES\n");
+            ProcessResult p = pw.execute();
+            Assert.assertTrue(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
+    @Test
+    public void javawsHtmlYesNo() throws Exception{
+            ProcessWrapper pw = new ProcessWrapper(server.getJavawsLocation(), Arrays.asList("-headless", "-html"),  server.getUrl("SandboxUnsignedMissing.html"));
+            pw.addStdOutListener(new AutoOkClosingListener());
+            pw.setWriter("YES\nNO\n");
+            ProcessResult p = pw.execute();
+            Assert.assertFalse(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
+    
+    @Test
+    public void javawsHtmlNo() throws Exception{
+            ProcessWrapper pw = new ProcessWrapper(server.getJavawsLocation(), Arrays.asList("-headless", "-html"),  server.getUrl("SandboxUnsignedMissing.html"));
+            pw.addStdOutListener(new AutoOkClosingListener());
+            pw.setWriter("NO\n");
+            ProcessResult p = pw.execute();
+            Assert.assertFalse(p.stdout.contains(confirmation));
+            Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+            Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 
 
 }
diff -r 08f1df9b7b4b -r fff25f4c1ff6 tests/reproducers/simple/SandboxUnsignedSandbox/testcases/SandboxUnsignedSandboxTest.java
--- a/tests/reproducers/simple/SandboxUnsignedSandbox/testcases/SandboxUnsignedSandboxTest.java	Wed Jul 22 13:16:26 2015 +0200
+++ b/tests/reproducers/simple/SandboxUnsignedSandbox/testcases/SandboxUnsignedSandboxTest.java	Wed Jul 22 14:39:17 2015 +0200
@@ -1,6 +1,7 @@
 
 import java.io.IOException;
 import java.util.Arrays;
+import net.sourceforge.jnlp.OptionsDefinitions;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
 import net.sourceforge.jnlp.annotations.TestInBrowsers;
@@ -112,5 +113,12 @@
             Assert.assertTrue(p.stderr.contains(aer.getCondition()));
     }
 
+     @Test
+    public void javawsHtml() throws Exception {
+        ProcessResult p = server.executeJavaws(Arrays.asList(new String[]{OptionsDefinitions.OPTIONS.HTML.option}), "SandboxUnsignedSandbox.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
+        Assert.assertTrue(p.stdout.contains(confirmation));
+        Assert.assertFalse(p.stdout.contains(aok.getCondition()));
+        Assert.assertTrue(p.stderr.contains(aer.getCondition()));
+    }
 
 }


More information about the distro-pkg-dev mailing list