Package org.apache.flex.forks.batik.test.svg

Examples of org.apache.flex.forks.batik.test.svg.SVGOnLoadExceptionTest$TestUserAgent


        // other security settings.
        //
        for (int i=0; i<scriptSource.length; i++) {
            for (int j=0; j<secure.length; j++) {
                for (int k=0; k<scriptOrigin.length; k++) {
                    SVGOnLoadExceptionTest t = buildTest(scripts,
                                                         scriptSource[i],
                                                         scriptOrigin[k],
                                                         secure[j],
                                                         false,
                                                         false);
                    addTest(t);
                }
            }
        }

        //
        // If script run in restricted mode, then there should be
        // a security exception, no matter what the other settings are
        // (if we are running code under a security manager, that is,
        // i.e., secure is true).
        scripts = "text/ecmascript";
        for (int i=0; i<scriptSource.length; i++) {
            for (int k=0; k<scriptOrigin.length; k++) {
                boolean expectSuccess = ((i>=2) && (k <= 2));
                SVGOnLoadExceptionTest t = buildTest(scripts,
                                                     scriptSource[i],
                                                     scriptOrigin[k],
                                                     true,
                                                     true,
                                                     expectSuccess);
                addTest(t);
            }
        }

        //
        // If "applicatin/ecmascript" is allowed, but the accepted
        // script origin is lower than the candidate script, then
        // the script should not be loaded (e.g., if scriptOrigin
        // is embeded and trying to load an external script).
        //
        for (int j=0; j<scriptOrigin.length; j++) {
            int max = j;
            if (j == scriptOrigin.length - 1) {
                max = j+1;
            }
            for (int i=0; i<max; i++) {
                for (int k=0; k<secure.length; k++) {
                    SVGOnLoadExceptionTest t= buildTest(scripts, scriptSource[i],
                                                        scriptOrigin[j],
                                                        secure[k],
                                                        false,
                                                        false);
                    addTest(t);
View Full Code Here


    }

    SVGOnLoadExceptionTest buildTest(String scripts, String id, String origin,
                                     boolean secure, boolean restricted,
                                     boolean successExpected) {
        SVGOnLoadExceptionTest t = new SVGOnLoadExceptionTest();
        String desc =
            "(scripts=" + scripts +
            ")(scriptOrigin=" + origin +
            ")(secure=" + secure +
            ")(restricted=" + restricted + ")";
       
        t.setId(id + desc);
        t.setScriptOrigin(origin);
        t.setSecure(secure);
        t.setScripts(scripts);
        if (successExpected)
            t.setExpectedExceptionClass(null);
        else
            t.setExpectedExceptionClass("java.lang.SecurityException");
        t.setRestricted(restricted);

        return t;
    }
View Full Code Here

        // other security settings.
        //
        for (int i=0; i<scriptSource.length; i++) {
            for (int j=0; j<secure.length; j++) {
                for (int k=0; k<scriptOrigin.length; k++) {
                    SVGOnLoadExceptionTest t = buildTest(scripts,
                                                         scriptSource[i],
                                                         scriptOrigin[k],
                                                         secure[j]);
                    addTest(t);
                }
            }
        }

        //
        // If "application/java-archive" is allowed, but the accepted
        // script origin is lower than the candidate script, then
        // the script should not be loaded (e.g., if scriptOrigin
        // is embeded and trying to load an external script).
        //
        scripts = "application/java-archive";
        for (int j=0; j<scriptOrigin.length; j++) {
            for (int i=0; i<j; i++) {
                for (int k=0; k<secure.length; k++) {
                    SVGOnLoadExceptionTest t= buildTest(scripts, scriptSource[i],
                                                        scriptOrigin[j],
                                                        secure[k]);
                    addTest(t);
                }
            }
View Full Code Here

            }
        }
    }

    SVGOnLoadExceptionTest buildTest(String scripts, String id, String origin, boolean secure) {
        SVGOnLoadExceptionTest t = new SVGOnLoadExceptionTest();
        String desc =
            "(scripts=" + scripts +
            ")(scriptOrigin=" + origin +
            ")(secure=" + secure + ")";
       
        t.setId(id + desc);
        t.setScriptOrigin(origin);
        t.setSecure(secure);
        t.setScripts(scripts);
        t.setExpectedExceptionClass("java.lang.SecurityException");

        return t;
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.forks.batik.test.svg.SVGOnLoadExceptionTest$TestUserAgent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.