Ignore:
Timestamp:
Sep 24, 2014, 9:34:21 PM (11 years ago)
Author:
dmik
Message:

icedtea-web: Merge version 1.5.1 from vendor to trunk.

Location:
trunk/icedtea-web/tests/reproducers/simple/AppletTest
Files:
1 edited
5 copied

Legend:

Unmodified
Added
Removed
  • trunk/icedtea-web/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java

    r418 r429  
    1 /* AppletTestTests.java
     1/*
    22Copyright (C) 2011 Red Hat, Inc.
    33
     
    3636 */
    3737
     38import net.sourceforge.jnlp.closinglisteners.CountingClosingListener;
    3839import net.sourceforge.jnlp.ProcessResult;
    3940import net.sourceforge.jnlp.ServerAccess;
     
    4849public class AppletTestTests extends BrowserTest {
    4950
     51    private final String s7 = "Aplet killing himself after 2000 ms of life";
     52    private final String s2 = "value2";
     53    private final String s1 = "value1";
     54    private final String s0 = "applet was started";
     55    private final String s3 = "applet was initialised";
     56
     57    private class CountingClosingListenerImpl extends CountingClosingListener {
     58
     59        @Override
     60        protected boolean isAlowedToFinish(String s) {
     61            return (s.contains(s0) && s.contains(s1) && s.contains(s2) && s.contains(s3) && s.contains(s7));
     62        }
     63    }
     64
    5065    @Test
    5166    @TestInBrowsers(testIn = {Browsers.googleChrome})
     
    5671            //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString());
    5772            //just verify loging is recording browser
    58             ProcessResult pr1 = server.executeBrowser("/appletAutoTests.html");
     73            ProcessResult pr1 = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
    5974            if (pr1.process == null) {
    6075                Assert.assertTrue("If proces was null here, then google-chrome had to not exist, and so "
     
    6580                return;
    6681            }
    67             evaluateApplet(pr1,false);
     82            evaluateApplet(pr1, false);
    6883            Assert.assertTrue(pr1.wasTerminated);
    6984            //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString());
    7085            // just verify loging is recording browser
    71             ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html");
    72             evaluateApplet(pr,false);
     86            ProcessResult pr = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
     87            evaluateApplet(pr, false);
    7388            Assert.assertTrue(pr.wasTerminated);
    7489        } finally {
     
    8196    public void AppletTest() throws Exception {
    8297        ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp");
    83         evaluateApplet(pr,true);
     98        evaluateApplet(pr, true);
    8499        Assert.assertFalse(pr.wasTerminated);
    85100        Assert.assertEquals((Integer) 0, pr.returnValue);
     
    87102
    88103    private void evaluateApplet(ProcessResult pr, boolean javawsApplet) {
    89         String s3 = "applet was initialised";
    90104        Assert.assertTrue("AppletTest stdout should contains " + s3 + " bud didn't", pr.stdout.contains(s3));
    91         String s0 = "applet was started";
    92105        Assert.assertTrue("AppletTest stdout should contains " + s0 + " bud didn't", pr.stdout.contains(s0));
    93         String s1 = "value1";
    94106        Assert.assertTrue("AppletTest stdout should contains " + s1 + " bud didn't", pr.stdout.contains(s1));
    95         String s2 = "value2";
    96107        Assert.assertTrue("AppletTest stdout should contains " + s2 + " bud didn't", pr.stdout.contains(s2));
    97         String ss = "xception";
    98         Assert.assertFalse("AppletTest stderr should not contains " + ss + " but did", pr.stderr.contains(ss));
    99         String s7 = "Aplet killing himself after 2000 ms of life";
    100108        Assert.assertTrue("AppletTest stdout should contains " + s7 + " bud didn't", pr.stdout.contains(s7));
    101109        if (!javawsApplet) {
    102110            /*this is working correctly in most browser, but not in all. temporarily disabling
    103         String s4 = "applet was stopped";
    104         Assert.assertTrue("AppletTest stdout should contains " + s4 + " bud did't", pr.stdout.contains(s4));
    105         String s5 = "applet will be destroyed";
    106         Assert.assertTrue("AppletTest stdout should contains " + s5 + " bud did't", pr.stdout.contains(s5));
     111            String s4 = "applet was stopped";
     112            Assert.assertTrue("AppletTest stdout should contain " + s4 + " bud did't", pr.stdout.contains(s4));
     113            String s5 = "applet will be destroyed";
     114            Assert.assertTrue("AppletTest stdout should contain " + s5 + " bud did't", pr.stdout.contains(s5));
    107115             */
    108116        }
     
    117125        ServerAccess.PROCESS_TIMEOUT = 30 * 1000;
    118126        try {
    119             ProcessResult pr = server.executeBrowser("/appletAutoTests2.html");
    120             evaluateApplet(pr,false);
    121             Assert.assertTrue(pr.wasTerminated);
     127            ProcessResult pr = server.executeBrowser("/appletAutoTests2.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
     128            evaluateApplet(pr, false);
     129            //Assert.assertTrue(pr.wasTerminated); this checks asre evil
    122130            //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
    123131        } finally {
     
    133141        ServerAccess.PROCESS_TIMEOUT = 30 * 1000;
    134142        try {
    135             ProcessResult pr = server.executeBrowser("/appletAutoTests.html");
     143            ProcessResult pr = server.executeBrowser("/appletAutoTests.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
    136144            pr.process.destroy();
    137             evaluateApplet(pr,false);
     145            evaluateApplet(pr, false);
    138146            Assert.assertTrue(pr.wasTerminated);
    139147            //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null
     
    142150        }
    143151    }
     152   
     153   
     154    @Test
     155    @TestInBrowsers(testIn = {Browsers.one})
     156    @NeedsDisplay
     157    public void appletZeroWH() throws Exception {
     158        ProcessResult pr = server.executeBrowser("/appletZeroWH.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
     159        evaluateApplet(pr, false);
     160    }
     161   
     162    @Test
     163    @TestInBrowsers(testIn = {Browsers.one})
     164    @NeedsDisplay
     165    public void appletZeroW() throws Exception {
     166        ProcessResult pr = server.executeBrowser("/appletZeroW.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
     167        evaluateApplet(pr, false);
     168    }
     169   
     170    @Test
     171    @TestInBrowsers(testIn = {Browsers.one})
     172    @NeedsDisplay
     173    public void appletZeroH() throws Exception {
     174        ProcessResult pr = server.executeBrowser("/appletZeroH.html", new CountingClosingListenerImpl(), new CountingClosingListenerImpl());
     175        evaluateApplet(pr, false);
     176    }
    144177}
Note: See TracChangeset for help on using the changeset viewer.