diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | tests/reproducers/simple/JSToJGet/resources/JSToJGet.html | 3 | ||||
-rw-r--r-- | tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js | 15 | ||||
-rw-r--r-- | tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js | 12 | ||||
-rw-r--r-- | tests/reproducers/simple/JSToJGet/srcs/JSToJGet.java | 27 | ||||
-rw-r--r-- | tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java | 18 |
6 files changed, 55 insertions, 35 deletions
@@ -1,3 +1,18 @@ +2013-02-06 Jana Fabrikova <[email protected]> + + * /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 parts 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 + 2013-02-06 Adam Domurad <[email protected]> Name threads for easier debugging/tooling. Remove 2 erroneous diff --git a/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html b/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html index 31ed1cb..8ab96d3 100644 --- a/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html +++ b/tests/reproducers/simple/JSToJGet/resources/JSToJGet.html @@ -93,6 +93,9 @@ case "DoubleFullArray": test_get_DoubleFullArray(); break; + case "JSObject": + test_get_JSObject(); + break; default: appletStdOutLn('jstojGetApplet', "No argument in URL! Should be e.g. JSToJGet.html?int"); document.getElementById( 'jstojGetApplet' ).setStatusLabel("Not a valid 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 index 97231fe..9931389 100644 --- a/tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js +++ b/tests/reproducers/simple/JSToJGet/resources/JSToJ_auxiliary.js @@ -1,18 +1,7 @@ /* JSToJ_auxiliary.js -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 -- JToJSGet -- JToJSSet -- JToJSFuncParam -- JToJSFuncReturn -- JToJSEval +This file contains auxiliary JavaScript functions for LiveConnect tests output +it is used by JSToJGet reproducer. */ function check(actual, expected, expectedtype, testid, appletName ) { diff --git a/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js b/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js index da4c080..d51c333 100644 --- a/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js +++ b/tests/reproducers/simple/JSToJGet/resources/JSToJava_Get.js @@ -245,5 +245,17 @@ function test_get_DoubleFullArray(){ 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 index 5c2511b..8023fe4 100644 --- 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,24 +29,29 @@ public class JSToJGet extends Applet { public char[] ca = new char[3]; public Character[] Ca = new Character[3]; + public JSObject jso; private Label statusLabel; - public void init() { - setLayout(new BorderLayout()); - statusLabel = new Label(); - add(statusLabel); - String initStr = "JSToJGet applet initialized."; - System.out.println(initStr); - statusLabel.setText(initStr); - + 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(); + add(statusLabel); + String initStr = "JSToJGet applet initialized."; + System.out.println(initStr); + statusLabel.setText(initStr); } // 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 index d3d00a3..982f0a9 100644 --- a/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java +++ b/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java @@ -56,7 +56,6 @@ public class JSToJGetTest extends BrowserTest { 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 @@ public class JSToJGetTest extends BrowserTest { @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 @@ public class JSToJGetTest extends BrowserTest { 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 @@ public class JSToJGetTest extends BrowserTest { 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 @@ public class JSToJGetTest extends BrowserTest { @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)"); + } } |