Debian Codegraph @

tests/reproducers/simple/IcoAccess/testcases/IcoAccessTest.java

raw
1 /* SimpleTest1Test.java
2 Copyright (C) 2011 Red Hat, Inc.
3
4 This file is part of IcedTea.
5
6 IcedTea is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, version 2.
9
10 IcedTea is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with IcedTea; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301 USA.
19
20 Linking this library statically or dynamically with other modules is
21 making a combined work based on this library. Thus, the terms and
22 conditions of the GNU General Public License cover the whole
23 combination.
24
25 As a special exception, the copyright holders of this library give you
26 permission to link this library with independent modules to produce an
27 executable, regardless of the license terms of these independent
28 modules, and to copy and distribute the resulting executable under
29 terms of your choice, provided that you also meet, for each linked
30 independent module, the terms and conditions of the license of that
31 module. An independent module is a module which is not derived from
32 or based on this library. If you modify this library, you may extend
33 this exception to your version of the library, but you are not
34 obligated to do so. If you do not wish to do so, delete this
35 exception statement from your version.
36 */
37
38 import java.util.Arrays;
39 import net.sourceforge.jnlp.OptionsDefinitions;
40 import net.sourceforge.jnlp.ProcessResult;
41 import net.sourceforge.jnlp.ServerAccess;
42 import net.sourceforge.jnlp.annotations.TestInBrowsers;
43 import net.sourceforge.jnlp.browsertesting.BrowserTest;
44 import net.sourceforge.jnlp.browsertesting.Browsers;
45 import net.sourceforge.jnlp.closinglisteners.AutoErrorClosingListener;
46 import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener;
47 import org.junit.Assert;
48
49 import org.junit.Test;
50
51 public class IcoAccessTest extends BrowserTest {
52
53 @Test
54 public void testJavawsCanUseIcoProvider() throws Exception {
55 ProcessResult pr = server.executeJavaws(null, "IcoAccess.jnlp");
56 Assert.assertTrue(pr.stdout.contains("IcoAccess running"));
57 Assert.assertTrue(pr.stdout.matches("(?s).*http.*IcoAccess.ico.*"));
58 Assert.assertTrue(pr.stdout.contains("array checks passed"));
59 //javaws CAN access our registered provider
60 Assert.assertTrue(pr.stdout.contains("ico: BufferedImage@"));
61 Assert.assertFalse(pr.stdout.contains("ico: null"));
62 Assert.assertTrue(pr.stdout.contains("IcoAccess ended"));
63 Assert.assertTrue(pr.stdout.contains("png: BufferedImage@"));
64 Assert.assertFalse(pr.stdout.contains("png: null"));
65
66 }
67
68 @Test
69 //well this si reallys trange.
70 //from outpouts its clear that ico provider IS registered..
71 public void testJavawsHeadlessCanNotUseIcoProvider() throws Exception {
72 ProcessResult pr = server.executeJavawsHeadless(null, "IcoAccess.jnlp");
73 Assert.assertTrue(pr.stdout.contains("IcoAccess running"));
74 Assert.assertTrue(pr.stdout.matches("(?s).*http.*IcoAccess.ico.*"));
75 Assert.assertTrue(pr.stdout.contains("array checks passed"));
76 //javaws CANNOT access our registered provider
77 Assert.assertFalse(pr.stdout.contains("ico: BufferedImage@"));
78 Assert.assertTrue(pr.stdout.contains("ico: null"));
79 Assert.assertTrue(pr.stdout.contains("IcoAccess ended"));
80 Assert.assertTrue(pr.stdout.contains("png: BufferedImage@"));
81 Assert.assertFalse(pr.stdout.contains("png: null")); //ok, I dont understand this. Normal providers works...
82 }
83
84 @Test
85 public void testJavawsHtmlCanUseIcoProvider() throws Exception {
86 ProcessResult pr = server.executeJavaws(Arrays.asList(new String[]{OptionsDefinitions.OPTIONS.HTML.option}), "IcoAccess.html", new AutoOkClosingListener(), new AutoErrorClosingListener());
87 Assert.assertTrue(pr.stdout.contains("IcoAccess running"));
88 Assert.assertTrue(pr.stdout.matches("(?s).*http.*IcoAccess.ico.*"));
89 Assert.assertTrue(pr.stdout.contains("array checks passed"));
90 //javaws CAN access our registered provider
91 Assert.assertTrue(pr.stdout.contains("ico: BufferedImage@"));
92 Assert.assertFalse(pr.stdout.contains("ico: null"));
93 Assert.assertTrue(pr.stdout.contains("IcoAccess ended"));
94 Assert.assertTrue(pr.stdout.contains("png: BufferedImage@"));
95 }
96
97 @Test
98 @TestInBrowsers(testIn = Browsers.one)
99 public void testAppletCanUseIcoProvider() throws Exception {
100 ProcessResult pr = server.executeBrowser("IcoAccess.html", ServerAccess.AutoClose.CLOSE_ON_BOTH);
101 Assert.assertTrue(pr.stdout.contains("IcoAccess running"));
102 Assert.assertTrue(pr.stdout.matches("(?s).*http.*IcoAccess.ico.*"));
103 Assert.assertTrue(pr.stdout.contains("array checks passed"));
104 //applets CAN access our registered provider
105 Assert.assertTrue(pr.stdout.contains("ico: BufferedImage@"));
106 Assert.assertFalse(pr.stdout.contains("ico: null"));
107 Assert.assertTrue(pr.stdout.contains("IcoAccess ended"));
108 Assert.assertTrue(pr.stdout.contains("png: BufferedImage@"));
109 Assert.assertFalse(pr.stdout.contains("png: null"));
110 }
111
112 }