ap@apple.com | fd21c99 | 2010-03-03 19:15:20 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"> |
| 6 | <script src="../../../fast/js/resources/js-test-pre.js"></script> |
| 7 | <script> |
| 8 | if (window.layoutTestController) { |
| 9 | layoutTestController.overridePreference("WebKitJavaEnabled", "1"); |
| 10 | layoutTestController.waitUntilDone(); |
| 11 | } |
| 12 | </script> |
| 13 | </head> |
| 14 | <body onload="onload()"> |
| 15 | |
| 16 | <div id="console"></div> |
| 17 | |
| 18 | <object |
| 19 | classid="clsid:CAFEEFAC-0015-0000-0000-ABCDEFFEDCBA" |
| 20 | width=500 |
| 21 | height=200 |
| 22 | <param name="codebase" value="../../../java"> |
| 23 | <param name="code" value="lc3.class"> |
| 24 | <param name="archive" value="jstests.jar"> |
| 25 | <comment> |
| 26 | <embed |
| 27 | code="lc3.class" |
| 28 | codebase="../../../java" |
| 29 | archive="jstests.jar" |
| 30 | type="application/x-java-applet" |
| 31 | width=500 |
| 32 | height=200> |
| 33 | <noembed> |
| 34 | No Java Support. |
| 35 | </noembed> |
| 36 | </comment> |
| 37 | </object> |
| 38 | |
| 39 | |
| 40 | <script> |
| 41 | function startTest() |
| 42 | { |
| 43 | window.applet = document.getElementsByTagName("embed")[0]; |
| 44 | if (!applet.createQAObject) |
| 45 | window.applet = document.getElementsByTagName("object")[0]; |
| 46 | |
| 47 | debug(TITLE + "\n"); |
| 48 | } |
| 49 | |
| 50 | function shouldBeWithErrorCheck(_a, _b) |
| 51 | { |
| 52 | // Don't want full stack traces from Java exceptions. |
| 53 | if (window.layoutTestController) { |
| 54 | try { |
| 55 | eval(_a); |
| 56 | } catch (ex) { |
| 57 | if (/Caused by: /.test(ex)) { |
| 58 | testFailed(_a + ": Exception raised"); |
| 59 | return; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | var b_eval; |
| 65 | try { |
| 66 | b_eval = eval(_b); |
| 67 | } catch (ex) { |
| 68 | testFailed(_b + ": " + ex); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | if (b_eval == "error") |
| 73 | shouldThrow(_a); |
| 74 | else |
| 75 | shouldBe(_a, _b); |
| 76 | } |
| 77 | |
| 78 | function wkTestStringToJavaByteArray(string) |
| 79 | { |
| 80 | return applet.stringToByteArray(string); |
| 81 | } |
| 82 | |
| 83 | function appendScript(text) |
| 84 | { |
| 85 | var el = document.createElement("script") |
| 86 | el.appendChild = document.createTextNode(text); |
| 87 | document.body.appendChild(el); |
| 88 | } |
| 89 | |
| 90 | function onload() |
| 91 | { |
| 92 | try { |
| 93 | var req = new XMLHttpRequest(); |
| 94 | req.open("GET", window.location.pathname.replace(/html$/, "js"), false); |
| 95 | if (req.overrideMimeType) |
| 96 | req.overrideMimeType("text/plain"); |
| 97 | req.send(); |
| 98 | |
| 99 | if (!req.responseText.length) |
| 100 | throw "could not load test script"; |
| 101 | |
| 102 | var scriptElement = document.createElement("script") |
| 103 | scriptElement.appendChild(document.createTextNode( |
| 104 | req.responseText + "\n" + |
| 105 | "successfullyParsed = true;\n")); |
| 106 | document.body.appendChild(scriptElement); |
| 107 | } catch (ex) { |
| 108 | testFailed("Could not run test: " + ex); |
| 109 | } |
| 110 | |
| 111 | scriptElement = document.createElement("script") |
ap@apple.com | 0525fe5 | 2010-03-03 22:22:27 +0000 | [diff] [blame^] | 112 | scriptElement.src = '../../../fast/js/resources/js-test-post-async.js' |
ap@apple.com | fd21c99 | 2010-03-03 19:15:20 +0000 | [diff] [blame] | 113 | document.body.appendChild(scriptElement); |
ap@apple.com | fd21c99 | 2010-03-03 19:15:20 +0000 | [diff] [blame] | 114 | } |
| 115 | </script> |
| 116 | </body> |
| 117 | </html> |