[rfc][icedtea-web] modifications to JSToJGet reproducer for Liveconnect
Adam Domurad
adomurad at redhat.com
Tue Feb 5 13:49:23 PST 2013
On 01/16/2013 10:57 AM, Jana Fabrikova wrote:
> Hi,
>
> i am sending a patch that modifies the JSToJGet reproducer (removing
> one KnownToFail and adding one testcase),
>
> thank you for any comments,
> Jana
>
> 2013-01-16 Jana Fabrikova <jfabriko at redhat.com>
>
> * /tests/reproducers/simple/JSToJGet/resources/JSToJGet.html:
> adding 1 testcase reading applets variable of type JSObject from JS
>
> * /tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java:
> adding 1 testcase reading applets variable of type JSObject from JS,
> small changes to evaluation of the applet's stdout methods, removing
> KnownToFail anotation from (AppletJSToJGet_DoubleFullArray_Test) method
>
> * /tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js:
> removing two lines of comment that are no longer true
>
> * /tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js:
> adding (test_get_JSObject) function also to the JS part of test
>
> * /tests/reproducers/simple/JSToJGet/srcs/JSToJGet.java:
> adding the JSObject variable to the applet
Be sure to format like rest of ChangeLog
>
>
> diff --git a/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html
> b/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html
> --- a/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html
> +++ b/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html
> @@ -92,6 +92,9 @@
> break;
> case "DoubleFullArray":
> test_get_DoubleFullArray();
> + break;a
> + case "JSObject":
> + test_get_JSObject();a
> break;
> default:
> appletStdOutLn('jstojGetApplet', "No argument in URL!
> Should be e.g. JSToJGet.html?int");
> diff --git
> a/tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js
> b/tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js
> --- a/tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js
> +++ b/tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js
> @@ -3,8 +3,6 @@
> This file contains auxiliary JavaScript functions for LiveConnect
> tests output,
> the following reproducers have this file as a common resource:
> - JSToJGet
> -- JSToJSet
> -- JSToJFuncParam
> - JSToJFuncReturn
> - JSToJFuncResol
> - JSToJTypeConv
> diff --git
> a/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js
> b/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js
> --- a/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js
> +++ b/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js
> @@ -245,5 +245,17 @@
> appendMessageDiv(e);
> }
> }
> +
> +function test_get_JSObject(){
> + var appletName = 'jstojGetApplet';
> + try{
> + var javao = new Object(document.getElementById(appletName).jso);
> + check(javao.key1, "value1", "string", "22 - (JSObject)",
> appletName);
> + }catch(e){
> + appletStdOut( appletName, e );
> + appendMessageDiv(e);
> + }
> +
> +}
>
>
> diff --git a/tests/reproducers/simple/JSToJGet/srcs/JSToJGet.java
> b/tests/reproducers/simple/JSToJGet/srcs/JSToJGet.java
> --- a/tests/reproducers/simple/JSToJGet/srcs/JSToJGet.java
> +++ b/tests/reproducers/simple/JSToJGet/srcs/JSToJGet.java
> @@ -1,5 +1,7 @@
> -import java.applet.*;
> -import java.awt.*;
> +import java.applet.Applet;
> +import java.awt.Label;
> +import java.awt.BorderLayout;
> +import netscape.javascript.JSObject;
>
> public class JSToJGet extends Applet {
>
> @@ -27,9 +29,22 @@
>
> public char[] ca = new char[3];
> public Character[] Ca = new Character[3];
> + public JSObject jso;
>
> private Label statusLabel;
>
> + public void start(){
> + JSObject win = JSObject.getWindow(this);
> + jso = (JSObject) win.getMember("document");
> + jso.setMember("key1","value1");
> + ia[4] = 1024;
> + Da1[9] = D;
> +
> + String setupStr = "JSToJGet applet set up for GET tests.";
> + System.out.println(setupStr);
> + statusLabel.setText(setupStr);
> + }
> +
> public void init() {
> setLayout(new BorderLayout());
> statusLabel = new Label();
> @@ -37,14 +52,6 @@
> String initStr = "JSToJGet applet initialized.";
> System.out.println(initStr);
> statusLabel.setText(initStr);
> -
> - ia[4] = 1024;
> - Da1[9] = D;
> -
> - String setupStr = "JSToJGet applet set up for GET tests.";
> - System.out.println(setupStr);
> - statusLabel.setText(setupStr);
> -
> }
>
> // auxiliary method for setting the statusLabel text:
> diff --git
> a/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java
> b/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java
> --- a/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java
> +++ b/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java
> @@ -56,7 +56,6 @@
> public String foundStr = "] found:[";
> public String endStr = "].";
>
> - private final String exceptionStr = "xception";
> private final String initStr = "JSToJGet applet initialized.";
> private final String setupStr = "JSToJGet applet set up for GET
> tests.";
> private final String afterStr = "afterTests";
> @@ -65,9 +64,6 @@
>
> @Override
> protected boolean isAlowedToFinish(String s) {
> - if (s.contains(exceptionStr)) {
> - return true;
> - }
> return (s.contains(initStr) && s.contains(setupStr) && s
> .contains(afterStr));
> }
> @@ -86,12 +82,10 @@
> String s0 = testStr + passStr;
> String s1 = testStr + failValStr;
> String s2 = testStr + failTypeStr;
> - String s3 = "Error on Java side";
>
> int ind0 = pr.stdout.indexOf(s0);
> int ind1 = pr.stdout.indexOf(s1);
> int ind2 = pr.stdout.indexOf(s2);
> - int ind3 = pr.stdout.indexOf(s3);
> int indBegin = pr.stdout.indexOf(setupStr);
> if (indBegin != -1) {
> indBegin += setupStr.length();
> @@ -116,11 +110,6 @@
> failStr = "JSToJGet: type mismatch in "+testStr;
> }
>
> - if (ind3 != -1) {
> - failStr = "JSToJGet: an error occured during " + testStr;
> - }
> -
> - Assert.assertTrue(failStr, (ind3 == -1));// no error on Java side
> Assert.assertTrue(failStr, (ind1 == -1));// no value mismatch
> Assert.assertTrue(failStr, (ind2 == -1));// no type mismatch
> Assert.assertTrue(failStr, (ind0 != -1));// test passed
> @@ -288,9 +277,14 @@
> @Test
> @TestInBrowsers(testIn = { Browsers.all })
> @NeedsDisplay
> - @KnownToFail
> public void AppletJSToJGet_DoubleFullArray_Test() throws Exception {
> jsToJavaGetTest("DoubleFullArray", "Test no.21 - (Double[] -
> full array)");
> }
>
> + @Test
> + @TestInBrowsers(testIn = { Browsers.all })
> + @NeedsDisplay
> + public void AppletJSToJGet_JSObject_Test() throws Exception {
> + jsToJavaGetTest("JSObject", "Test no.22 - (JSObject)");
> + }
> }
Looks OK for HEAD,
-Adam
More information about the distro-pkg-dev
mailing list